• I have wp set up to display the most recent 7 Days on my home page (www.stirman.net) You’ll notice on my sidebar I have a section called “previously”. I would like for this to display the week before the current week, or posts from 7-14 days ago, make sesne? OR, (this might be easier), display a fixed number of entries previous to the last enty being displayed on the home page.

    I am using the previous_posts plug-in right now, but it’s working correcty, the list never changes, dunno why…

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • add this

    function get_recent_posts($no_posts = 6, $before = '<li>', $after = '</li>', $show_pass_post = false, $skip_posts = 0) {
    global $wpdb, $tableposts;
    $request = "SELECT ID, post_title FROM $tableposts WHERE post_status = 'publish' ";
    if(!$show_pass_post) { $request .= "AND post_password ='' "; }
    $request .= "ORDER BY post_date DESC LIMIT $skip_posts, $no_posts";
    $posts = $wpdb->get_results($request);
    $output = '';
    foreach ($posts as $post) {
    $post_title = stripslashes($post->post_title);
    $permalink = get_permalink($post->ID);
    $output .= $before . '<a href="' . $permalink . '" rel="bookmark" title="Permanent Link: ' . $post_title . '">' . $post_title . '</a>' . $after;
    }
    echo $output;
    }

    in your my-hacks.php file ….

    then use this

    <?php get_recent_posts(10, '', '<br />', true, 7); ?>

    to call the 10 posts BEFORE the most recent 7 posts …

    make sense?

    is there a my-hacks.php file in wp 1.5?

    If it isn’t there just create it (add to the root directory of the blog). Also make sure “Use legacy my-hacks.php file support” is checked under Options > Miscellaneous.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Previous 7 Days’ is closed to new replies.