Skip to:
Content
Pages
Categories
Search
Top
Bottom

if statement for forum root?

  • @poonasor

    Participant

    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

    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!'  ;

    @poonasor

    Participant

    thank you!! really appreciate it

    @robin-w

    Moderator

    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