Skip to:
Content
Pages
Categories
Search
Top
Bottom

Serving menu based on forum parent


  • Shadowpro
    Participant

    @slidstershadowprocomau

    I am building a site that is constructed of hubs with a parent forum as the base.

    At the moment I serve a different menu to /PARENT1/ and /PARENT2/ and that works fine until they go into a topic as then the /PARENTX/ slug disappears, along with the parent menu.

    Is there a way I can find out which parent forum the user is in to serve a set menu or header?

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

  • Shadowpro
    Participant

    @slidstershadowprocomau

    Figured it out finally.

    `”39″ is the page ID of the parent

    if ( is_singular() || bbp_is_forum_edit() || bbp_is_topic_edit() || bbp_is_reply_edit() )
    $ancestors = array_reverse( (array) get_post_ancestors( get_the_ID() ) );
    //$parent = get_post( $parent_id );
    if (in_array(’39’, $ancestors))
    //if ($ancestors == 39)
    {
    echo ‘blahblah’
    } `


    dbungard
    Participant

    @dbungard

    Trying to add

     && !current_user_can("access_s2member_level4") ;
    

    to what you have… but gave error saying that the array was not longer an array. Do you know how to do this?

    also is page = post id? if not, how did you find the page id?

    thank you


    Shadowpro
    Participant

    @slidstershadowprocomau

    Not sure as I’ve never used s2member like that.

    Maybe post the whole code & someone may know?

    Post & page ID are the same I think. Hover over the page/post and you’ll see the ID number shown in the url right at the bottom of the browser window.

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