• <?php
    $today = current_time('mysql', 1);
    $howMany = 5; //Number of posts you want to display
    if ( $recentposts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'publish' AND post_modified_gmt < '$today' ORDER BY post_modified_gmt DESC LIMIT $howMany")):
    ?>
    
    <h2><?php _e("Recent Updates"); ?></h2>
    <ul>
    <?php
    foreach ($recentposts as $post) {
    if ($post->post_title == '') $post->post_title = sprintf(__('Post #%s'), $post->ID);
    echo "<li><a href='".get_permalink($post->ID)."'>";
    the_title();
    echo '</a></li>';
    }
    ?>
    </ul>
    <?php endif; ?>

    I found this code what I was looking that shows the recent page and post. What I am having little trouble (not enough knowledge) is to show separate from the two. One for recent pages and one for recent post. I could use the default one for post, but I can never find one for pages.

    Thank you

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘2 seperate code from recent post and page’ is closed to new replies.