• I am trying to hack the sidebar — or even replace it with an included file — so that I have the latest 5 posts from a particular category based upon the parent of the actual page being displayed.

    <?php
    if (125 == $post->post_parent) {
    $args = array(
        'numberposts'     => 5,
        'offset'          => 0,
        'category'        => 5,
        'orderby'         => 'post_date',
        'order'           => 'DESC',
        'post_type'       => 'post',
        'post_status'     => 'publish' );
    }
    
    get_posts( $args );
    
    ?>

    Can someone offer advice?

  • The topic ‘posts by parent page in sidebar’ is closed to new replies.