WordPress.org

Ready to get started?Download WordPress

Forums

permalinks pointing to categories not posts in homemade dropdown menu (2 posts)

  1. saltier
    Member
    Posted 5 years ago #

    Hi,
    My first post on this forum I hope this is not to silly a question.

    Im trying to build a dropdown menu from posts in a category.
    In other words I have a menu in my sidebar of categories in my blog, when you select a menu item I want a list of all the posts in the menu to appear with permalinks to the posts underneath the menu item.
    Im not yet very familiar with wordpress codex but Ive managed sort of something that looks almost like what I want using this code

    ' books
    <?php if ( in_category(boeken) ) {
    while (have_posts()) : the_post();
    // the content of the post
    the_title('', '','display');

    endwhile;
    } else {
    echo ' ';
    }
    ?> '

    Not as elegant as I would like but it works, except for 1 thing the permalink in all the posts belonging to the category books point to the category not the post.
    I'm probably doing this in completely the wrong manner but maybe somebody can point me in the right direction!

    Regards and hopefully somebody can help!

  2. saltier
    Member
    Posted 5 years ago #

    I managed to solve this problem and the permalinks now open each individual post

    I managed this way
    the_title('<a href='.get_permalink($post->ID).'>', '</a><br />','display');

    But one problem remains and that is how to keep my dropdown category open when I select one of the posts in it?
    Anybody any ideas?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.