WordPress.org

Ready to get started?Download WordPress

Forums

List only current posts in a catagory... tag (5 posts)

  1. thunder
    Member
    Posted 8 years ago #

    Would like to create a page that lists all posts in a given catagory (like a sitemap). Trouble is that if I use this tag...
    < ?php wp_cat_posts(1); ?>
    it displays every post including forward dated posts.

    That causes a 404 error if a visitor clicks on a link to a page that is forward dated. To see what I mean cilck on a few of the bottom links on this page...
    http://www.problogtips.com/site-promotions/

    Is there a tag that will only display current posts in a catagory.

    Thanks in advance

  2. MichaelH
    Member
    Posted 8 years ago #

    After a little research it seems you might be using a Plugin called Category Posts Plugin V1.0. If that is the case, you could consider contacting the plugin author to make a change to the plugin or you could try changing wp_category_posts.php where it says:

    $get_posts_in_cat .= "AND $wpdb->posts.post_status = 'publish' ";

    to

    $get_posts_in_cat .= "AND $wpdb->posts.post_status = 'publish' AND posts.post_date < NOW()";

    Please note that I didn't test this.

    Also note, when the version of WordPress, currently referred to as 2.1-alpha1, gets released, this plugin will need to be updated to work properly.

    ********************
    Welcome to the WordPress Support Forums!

    Please help keep the Forums successful by reading:
    Using the Support Forums

    Also, remember the WordPress Codex and the FAQ pages.

    And, thank you, for letting us know if this information proves useful (or not)!
    ********************

  3. thunder
    Member
    Posted 8 years ago #

    Hi MichaelH,
    Tried your suggestion but it didnt work. Just got a blank space where the content would normally appear. Your suggestion at least opened my eyes to how some things can be altered, but still no luck with my problem.

  4. MichaelH
    Member
    Posted 8 years ago #

    Just looked and that line should be:

    $get_posts_in_cat .= "AND $wpdb->posts.post_status = 'publish' AND $wpdb->posts.post_date < NOW()";

  5. thunder
    Member
    Posted 8 years ago #

    Thanks MichaelH,

    It works perfectly.

    Cheers

Topic Closed

This topic has been closed to new replies.

About this Topic