Support » Fixing WordPress » List only current posts in a catagory… tag

  • 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…

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

    Thanks in advance

Viewing 4 replies - 1 through 4 (of 4 total)
  • 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' ";


    $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)!

    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.

    Just looked and that line should be:

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

    Thanks MichaelH,

    It works perfectly.


Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘List only current posts in a catagory… tag’ is closed to new replies.