Support » Fixing WordPress » Menu listing all posts in current category

  • I’d like the menu to have a section that dynamically displayed links to all (or up to a certain number) the posts in a given category. So, if I am in category “books” and I have 10 posts on 10 different books, there will be a menu that says:
    Contents
    -Book1
    -Book2
    -Book3
    …etc.
    With the titles of the posts for each book.
    Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Just to explain further. I need a snippit of code that will:
    (1) figure out what the current category is.
    (2) Display a list of all posts in that category, as a menu with links to the name of the posts.
    I really need to be able to do this in order for WP to work for the site I am planning, but I don’t know how to go about this. Any suggestions would be greatly appreciated!

    OK, from this wiki page:
    http://wiki.wordpress.org/index.php/PostsByCategory
    I was able to get a start. However, I’m still running into trouble.
    Here is what I have:
    <?php
    $cat=”5″;
    $blog=1;
    require_once(“wp-blog-header.php”);
    foreach ($posts as $post) { start_wp(); //start of loop
    echo “<br/> ” . the_title() . ““;
    } //end of loop
    ?>
    This has two problems.
    (1) It doesn’t produce the right code. For some reason, the “title” appears before the start of the URL, rather than inbetween the href = tag and the closing tag like I would think it should. I have no idea why this is happening.
    (2) I still have to manually specify the category. I would like it to be able to know the category of the current post.
    Thanks!

    This is ugly, but it works:

    <?php
    $cat=get_category_names();
    $blog=1;
    require_once("wp-blog-header.php");
    foreach ($posts as $post) { start_wp(); //start of loop
    ?>

  • " rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?>
    <?
    } //end of loop
    ?>

    It requires this hack:
    http://wordpress.org/support/3/1621#post-4

This is ugly, but it works:
<?php
$cat=get_category_names();
$blog=1;
require_once(“wp-blog-header.php”);
foreach ($posts as $post) { start_wp(); //start of loop
?>

  • ” rel=”bookmark” title=”Permanent Link: <?php the_title(); ?>”><?php the_title(); ?>
    <?
    } //end of loop
    ?>
    It requires this hack:
    http://wordpress.org/support/3/1621#post-4
  • [Sorry, I discovered that the “code” tags don’t work in these forums. I found the “escape HTML entitites” page however. Hopefully this will work!]
    This is ugly, but it works:
    <?php
    $cat=get_category_names();
    $blog=1;
    require_once("wp-blog-header.php");
    foreach ($posts as $post) { start_wp(); //start of loop
    ?>

  • " rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?>
    <?
    } //end of loop
    ?>
    It requires this hack:
    http://wordpress.org/support/3/1621#post-4
  • Arghh!
    It turns out that this hack doesn’t work at all. If you click on a “category” link it does show all posts in the category, but if you click on the permalink to an individual post it only shows that post, not the other ones in the same category!
    HELP! (please)

    Luhman,

    I’m sure you have solved this by now, but I think when you clikc on the permilink it’s bringing you to a different page in the template therefor you need to create a new menu… for that page.

    Viewing 7 replies - 1 through 7 (of 7 total)
    • The topic ‘Menu listing all posts in current category’ is closed to new replies.