Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter Jack

    (@moxie)

    LOL. That link was the same link as I posted!

    That’ll teach me for zooming over the links…

    All I can think is to place something like this right at the start of your index.php, just before require('./wp-blog-header.php'); (for 1.5, this goes in the index.php in your blog’s root, and not your theme’s):

    if (empty($_SERVER['QUERY_STRING'])) {
    $m = date('Ym');
    }

    Moderator James Huff

    (@macmanx)

    Login to you admin interface and go to Options/Reading. Under Reading Options/Front Page at “Show the most recent:”, enter 30 and choose “Days” from the pull-down menu.

    Thread Starter Jack

    (@moxie)

    Yes, but that will show perhaps 15 days of januari and 15 days of december, while I want to have it show only the posts from januari, wether these are 10 posts or just one post. And if I were on vacation in januari it should show the posts from december.

    Kafkaesqui, if I were to use your option it would show this month, wether it has posts or not. So I should have something that checks which month actually does have posts, and then call index.php with ?m=200501 (or whatever month that has posts).

    moxie: Yep, same limitation as Beel’s solution in *the thread that shall not be named (but will be linked to)*. One thing I imagine could work here is a sql query for ‘published’ posts with timestamps matching the current month.

    This would mean one of two things: (1) You’d have to do this along with Beel’s suggestion. (2) You’d have to load wp-config.php before wp-blog-header.php is included, for easy access to the database, etc. For (2), perhaps this will work:

    require_once('./wp-config.php');
    $match = $wpdb->get_col("SELECT post_date FROM wp_posts WHERE post_date REGEXP '^" . date('Y-m') . "'");
    if (empty($_SERVER['QUERY_STRING']) && $match) {
    $m = date('Ym');
    }

    Thread Starter Jack

    (@moxie)

    Hmm, that does work partly! It now returns the ‘home’-page with the month, but with posts paged (10 posts per page). Could it be made to always give back an ?m variable? In that case it would ??nd show posts paged set to 100 (just to cover every possible number of posts made in one month time) ??nd the previous and next Archive date plugin (by Scriptygoddess) would be triggered to show a link to the previous month at the same time.

    Apologies at first coz I’m a bit of a beginner. Do you guys see old posts? I suspect this post might solve my problem, but I’ve no idea how to implement the sql code suggested here. I have a specific need for it. Can someone tell me where to put the sql code — in wp-blog-header.php?

    I’m trying to put a static magazine website into WordPress. We have 1200+ entries dating back to 2000. I’ve imported them all using MT templates — very easy.

    Problem is we up date the contents once a month. We want the latest month’s contents on the first page, but no more. I thought setting display “30 days” in the Reading admin screen should do this, but of course I get 30 months worth because we upload a set of posts on the same day every month — usually 1st of month!

    Additional question: I imported each month’s entries with identical time stamps. If I varied the time stamps per entry, e.g. 1 March 1am, 1 March 2am etc would this solve the problem? If I did 1 March, 2 March etc, would that work? We have 20-30 entries a month, but not a fixed number.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Recent month (or latest that has posts) as startpage’ is closed to new replies.