help assembling an SQL statement in a plugin (2 posts)

  1. nearlythere
    Posted 10 years ago #

    i asked how to restrict nearfutureposts to categories. and the very generous (albeit busy) writer came back and offered this snippet:

    AND ".$wpdb->post2cat."category_id in (1,2,3)

    ... which should be added to the main function in the plugin... but sadly i don't know where to paste it! (many tries turned up SQL errors) this is the original line...

    $content = preg_replace("/AND post_date_gmt <= '(d{4})-(d{2})-(d{2}) (d{2}):(d{2}):(d{2})'/", "AND post_date_gmt <= '".$nearfuture."'", $content);

    where should the snippet (at top of message) go?

    nearfutureposts plugin homepage where this came from:

  2. nearlythere
    Posted 10 years ago #

    ignore this...

    nevermind i got it, and it doesn't work anyway!

    $content = preg_replace("/AND post_date_gmt <= '(d{4})-(d{2})-(d{2}) (d{2}):(d{2}):(d{2})'/", "AND post_date_gmt <= '".$nearfuture."' AND ".$wpdb->post2cat."category_id in (1,2,23)", $content);

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.