WordPress.org

Ready to get started?Download WordPress

Forums

Content Unique to Group of Pages/Category (1 post)

  1. WebTechGlobal
    Member
    Posted 5 years ago #

    Hey all,

    I'm trying to display a menu specific to a collection of pages and categories as if to make a section in the blog.

    http://mykidsdeservebetter.com/parents

    That URL displays a menu top left that only appears when visiting "parents". I use slug to check this. If I click on the "Parent Talk Page" link, this url...

    http://mykidsdeservebetter.com/parents/parent-talk-page

    The menu will no longer show, I tried "parent-talk-page" and "parents/parent-talk-page" in my If statement but the slug does not seem to match these.

    It is because of this...

    <?php
    $post_obj = $wp_query->get_queried_object();
    $slug = $post_obj->post_name;
    if($slug == "parents" || $slug == "students")
    {
    $_SESSION['page-requested'] = $slug;
    }
    else
    {
    $_SESSION['page-requested'] = " ";
    }?>

    It would be a very long task to extend the initial if statement to include all slugs so is there a better way of doing this?

    Thanks all
    Ryan

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.