WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How do I show child posts? (9 posts)

  1. FionaGilbert
    Member
    Posted 4 years ago #

    Morning all,

    I am having a little problem showing child post listings.

    When I select - for example - the link 'bands' from parent link 'entertainment' it tells me 'sorry no posts'. Why is this?

    This is my code: ' <?php $a = 1; $query1 = new WP_Query();$query1->query('posts_per_page=5&cat=' . get_query_var('cat')); ?>
    <?php while ($query1->have_posts()) : $query1->the_post(); ?>'

    What might I be doing wrong?

    Thanks for any assistance.

  2. MichaelH
    Member
    Posted 4 years ago #

    What is a child post? A post belonging to a child category? Or a child page?

  3. FionaGilbert
    Member
    Posted 4 years ago #

    Sorry, a child category.

    Thank you

  4. MichaelH
    Member
    Posted 4 years ago #

    You shouldn't need any special query to do that.

    Switch to the WordPress Default theme and then click on a child category link. Don't you see the posts.

    Related:
    Category Templates
    Template Hierarchy

  5. FionaGilbert
    Member
    Posted 4 years ago #

    Hmmmmm, no I don't. Checkout my partner's server:

  6. MichaelH
    Member
    Posted 4 years ago #

    Update your permalinks by visiting Administration > Settings > Permalinks and clicking on Save Changes.

  7. FionaGilbert
    Member
    Posted 4 years ago #

    Hmmmmm, still no joy. I am using this permalink structure: /%category%/%postname%/

  8. FionaGilbert
    Member
    Posted 4 years ago #

    Found the problem. The plugin: Top Level Categories - http://fortes.com/projects/wordpress/top-level-cats/

    Removes the prefix from the URL for a category. For instance, if your old category link was /category/catname it will now be /catname

    Shame I can't use this but I understand why.

    Thanks for your help.

  9. FionaGilbert
    Member
    Posted 4 years ago #

    OK Fixed. Used this plugin which worked just fine: http://wordpress.org/extend/plugins/wp-no-category-base/

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.