Skip to:
Content
Pages
Categories
Search
Top
Bottom

if statement for forum root?


  • Ricky Poon
    Participant

    @poonasor

    if there a if statement I can use to target the forum root like is_front_page()

    I know there is get_post_type() == ‘forum’ but it also targets the individual forums as well. i only want to target the root forum page.

    Thank you, appreciate it

Viewing 3 replies - 1 through 3 (of 3 total)

  • Robin W
    Moderator

    @robin-w

    this should do it

    function rew_check_forum_root () {
    $forum_slug = '/'.bbp_get_root_slug().'/' ;
    $page_slug = $_SERVER['REQUEST_URI'] ;
    if ($page_slug == $forum_slug) return true ;
    else return false ;
    }
    
    if (rew_check_forum_root() ) echo 'we are at the forum root!'  ;

    Ricky Poon
    Participant

    @poonasor

    thank you!! really appreciate it


    Robin W
    Moderator

    @robin-w

    no problem, – glad you are fixed !

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar