Forums

List Posts by Category (4 posts)

  1. JakeThePeg
    Member
    Posted 5 years ago #

    Good morning/arvo/eve,

    I would like to create a "Sitemap" of my blog.

    I have created a page called "sitemap", and have a plugin which allows me to embed php code directly into pages/posts.

    Now I require the php code which will enable me to list every single post as a hyperlink, ordered by category.

    For example:

    Category #1
    Post #1a
    Post #1b
    Category #2
    Post #2a
    Post #2b
    Post #2c etc etc

    I would also like to know how to exclude particular categories.

  2. moshu
    Member
    Posted 5 years ago #

  3. dondiego2007
    Member
    Posted 4 years ago #

    mmmh, I have done all the suggested changes but it doesn't work. may be there are different 'polyglot' plugins? if someone reads... tks in advance

  4. Manalishi
    Member
    Posted 4 years ago #

    I had trouble finding the answer to this one but finally did. Here is the code to list posts by category in your sidebar:

    '<!--Show posts by category-->
    <?php if (in_category('4')) : ?>
    <?php $my_query = new WP_Query('cat=4&showposts=15'); ?>
    <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>

  5. "><?php the_title(); ?><br/>
  6. <?php endwhile; ?>

    <?php endif; ?>
    <!--End Show posts by category--> '

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags