Blogging never tasted this good

Well, I finally decided to finish up the design I had started the other day; I managed to integrate most of the coding into WordPress. Which was less than irritating because I also had to port on over a few template pages that are being used for a few pages. The best is that I managed to *finally* use conditional tags for the sidebar so that you don’t see the same useless crap on every page (though it’s yet to be configured to have proper information on each page; I’ll get around to that.) I also found a fantastic function to help with displaying child pages when on a parent page.

I’ve never been able to find a snippet of code that would allow me to show child pages, and still show the child pages while on a child page of the parent page (did that make any sense!) Regardless, if you’re interested in ditching a plugin you might be using, here’s the snippet of coding you can use:

post->post_parent) ) { $parent = $wp_query->post->ID; } else { $parent = $wp_query->post->post_parent; } wp_list_pages("title_li=&child_of=$parent"); ?>

Anyway, I think I have most of site working properly. I haven’t tested it for valid XHTML and CSS, but I’ll get around to it eventually. It’s mainly the posts I have to clean through because I’m quite careless when I’m blogging, just not when I’m coding. Let me know what you think, and if you’ve got any suggestions/critiques, etc. All is welcome ;op

PS – This design is not fluid, and currently is not fully function in IE6 and is somewhat dilapidated in IE7.

10 Comments

  1. I love the tagline and the muffin. It does look edible though. Maybe they should have had one of those on the ‘don’ lick’ website. 😛

  2. Mallory that snippet of code is used to display child pages of a parent page. It also maintains while on a child page as well.

    This would go anywhere you wanted subpages to show up.

    If you want it in your sidebar, but only wanted it to show on a page, you’d use these conditional tags:
    is_page()

  3. Jenny, here is another piece of coding I’ve been using lately:

    <?php
    global $notfound;
    if (is_page() and ($notfound != ‘1’)) {
    $current_page = $post->ID;
    while($current_page) {
    $page_query = $wpdb->get_row("SELECT ID, post_title, post_status, post_parent FROM $wpdb->posts WHERE ID = ‘$current_page’");
    $current_page = $page_query->post_parent;
    }
    $parent_id = $page_query->ID;
    $parent_title = $page_query->post_title;

    // if ($wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent = ‘$parent_id’ AND post_status != ‘attachment’")) {
    if ($wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent = ‘$parent_id’ AND post_type != ‘attachment’")) {
    ?>

    <ul>
    <?php wp_list_pages(‘sort_column=menu_order&title_li=&child_of=’. $parent_id); ?>
    </ul>
    <?php } } ?>

Comments are closed.