• Hi,
    Ive created a dropdown menu off categories with posts.
    What i want it to do is when a category is selected to show a list of all posts in this category underneath.
    So far so good this works in my version
    But now i would like to keep the dropdown open in single post view for the relevant category is there a way to find the categroy and all posts in it when I’ve opened a post?
    This is the code of my dropdown.

    <a style="font-weight:bold" href="?cat=4">category</a>
    <?php if(is_category(websites)) {
    echo '<div style=border-top-width:1px;height:6px;border-top-style:solid></div>';
     while (have_posts()) : the_post();
     // the content of the post
    the_title('<a href='.get_permalink($post->ID).'>', '</a>','display');
    endwhile;
    }
    ?>
    
    <a style="font-weight:bold" href="?cat=14">another category</a>
     <?php if((is_category(flyer)))  {
    echo '<div style=border-top-width:1px;height:6px;border-top-style:solid></div>';
     while (have_posts()) : the_post();
     // the content of the post
    the_title('<a href='.get_permalink($post->ID).'>', '</a>','display');
    endwhile;
    }
    ?>
    <a style="font-weight:bold" href="?cat=16">different category</a>
     <?php if((is_category(identiteiten)))  {
    echo '<div style=border-top-width:1px;height:6px;border-top-style:solid></div>';
     while (have_posts()) : the_post();
     // the content of the post
    the_title('<a href='.get_permalink($post->ID).'>', '</a>','display');
    endwhile;
    }
    ?>

The topic ‘Dropdown menu made off categories with posts’ is closed to new replies.