WordPress.org

Support

Support » Plugins and Hacks » help assembling an SQL statement in a plugin

help assembling an SQL statement in a plugin

  • 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:
    http://blog.idahocline.info/2005/07/04/near-future-posts-plugin/

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

Viewing 1 replies (of 1 total)
  • The topic ‘help assembling an SQL statement in a plugin’ is closed to new replies.