• On my old web site, I had a page of links to every article I wrote, broken down by category (and all created by hand in HTML, which should tell you why I’m moving to WordPress). I’d like to recreate this same sort of page on my WordPress site.

    Here’s the basic layout of the page now:

    http://www.lisavollrath.com/pages/category/how-to/

    What I’d really like it to do is this:

    Child category 1:
    – Post 1
    – Post 2
    – Post 3

    Child category 2:
    – Post 1
    – Post 2
    – Post 3

    Child category 3:
    – Post 1
    – Post 2
    – Post 3

    I’m already using a custom category page for this parent category, so I just need something that will list its children, and the posts categorized under those children.

    Is this possible?

Viewing 7 replies - 1 through 7 (of 7 total)
  • If you use Pages rather than Posts to store your content, then you can then create your top level Pages as Main Page (No Parent), and set the Page Parent for each of the children to the appropriate Main Page.

    No need to use categories at all 🙂

    John

    Thread Starter lisavollrath

    (@lisavollrath)

    I already have about half my articles moved into posts, so I’d prefer not to have to backtrack. Is there a way to do this using category pages?

    Thread Starter lisavollrath

    (@lisavollrath)

    OK, I found a way to do this, but I’m having trouble getting it running on my site. I know I’m missing a line at the end of each section, but I don’t know what it is.


    <h3>Stuff About Me</h3>
    <ul>
    <?php
    $posts = get_posts('numberposts=2&order=ASC&category=34');
    foreach ($posts as $post) : start_wp(); ?>
    <li> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a><br />
    <?php the_excerpt(); ?></li><p>
    <?php endforeach; ?>
    <li> <a href=http://www.lisavollrath.com/pages/category/according-to-lisa/about-me/>more articles in this category...</a></li></ul>

    <h3>Stuff About My Art</h3>
    <ul>
    <?php
    $posts = get_posts('numberposts=2&order=ASC&category=39');
    foreach ($posts as $post) : start_wp(); ?>
    <li> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a><br />
    <?php the_excerpt(); ?></li><p>
    <?php endforeach; ?>
    <li> <a href=http://www.lisavollrath.com/pages/category/according-to-lisa/about-my-art/>more articles in this category...</a></li></ul>

    <h3>Stuff About My Workspace</h3>
    <ul>
    <?php
    $posts = get_posts('numberposts=2&order=ASC&category=35');
    foreach ($posts as $post) : start_wp(); ?>
    <li> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a><br />
    <?php the_excerpt(); ?></li><p>
    <?php endforeach; ?>
    <li> <a href=http://www.lisavollrath.com/pages/category/according-to-lisa/about-my-workspace/>more articles in this category...</a></li></ul>

    What goes between each section? I’ve tried <?php endwhile; ?> between each one, and I get a blank page. I’ve also tried <?php endif; ?>, and same blankness. However, if I post it as is, I get the desired result in the first section—title, the first two articles, and a more link—and then just title, bullets, and the more link for the remaining sections. It’s just not sucking in the article links this way.

    Sorry if that’s a winding description. I’m an artist, not a developer, and up until two weeks ago, I was doing everything on my site with perl and cgi. This PHP stuff is kicking my butt…

    Thread Starter lisavollrath

    (@lisavollrath)

    Oh, also, if anyone has a shorter way to write all the hard coded links, I’m all ears.

    Thread Starter lisavollrath

    (@lisavollrath)

    Anybody?

    Thread Starter lisavollrath

    (@lisavollrath)

    Nevermind—I worked it out myself. Thanks so much for all the help.

    I have exactly the same need for a page with articles broken down by category…I really enjoy WP – but I also need such a page, but can’t figure it out….I really like the solution lisa has done on her webpage – but I can’t implemented on mine….anyone knows the code?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Children and posts on a parent page?’ is closed to new replies.