WordPress.org

Support

Support » How-To and Troubleshooting » Custom Archive Problem

Custom Archive Problem

  • Hey everyone:

    I was messing around all day on my new site yesterday and couldn’t fix one problem I’m having … hopefully someone can help me.

    I have several Child Pages that run off of their own page.php. How do I code this page to display a custom archive for a particular category? I tried copying and modifying code from the standard archive.php and even played around in support for a while, but can not find a solution.

    The site is http://www.bismag.com. If you click on the ‘MUSIC’ link under the header you see a second navigation bar pop-up that displays the Child Pages [eventually every page will do this]. If you click on the ‘MUSIC REVIEWS’ Child Page you’ll see very little. I want this to show a standard archive for category 4 only. I can’t figure out how to manipulate the wp_query for my own page. Any suggestions will be greatly appreciated.

    Thanks,
    Nick

Viewing 3 replies - 1 through 3 (of 3 total)
  • Ahh! Help please! I was hoping this wouldn’t be too difficult and I was just overlooking something.

    I don’t know way, but this support really slow to replied 🙁 I want to know how to do this also.

    Add to your theme’s page.php:

    <?php if (is_page('name of page')){
    //do stuff
    } elseif (is_page('name of another page')){
    //do different stuff
    } elseif (is_page('name of yet another page')){
    //do more different stuff
    } else {
    //what to do if it isn't one of the previously mentioned pages
    } ?>

    What the “do stuff” is depends on what you want to do.

    If you want to be fancy and show an excerpt of posts as well as the headlines for posts in the category or categories, you will need to use a second loop. See the “multiple loops” section:

    http://codex.wordpress.org/The_Loop

    Otherwise, to simply show a link to a related category or categories, you can use wp_list_categories. You will probably want to use the “include” parameter to set the category that displays with each page.

    Hope that helps.

    If anyone knows how to use wp_list_categories in an array to echo the category descriptions as well, that would be wonderful to know.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom Archive Problem’ is closed to new replies.