Controleaza cand sa apara articolele in RSS

De multe ori faci un articol si iti dai seama ca ai facut o greseala. Doresti sa il schimbi dar degeaba deoarece el se gaseste in feed!

Ce poti face? Te poti folosi de urmatorul hack si sa amani postarea unui articol in feed cu un anumit numar de minute.

[php]

function publish_later_on_feed($where) {
global $wpdb;

if ( is_feed() ) {
// timestamp in WP-format
$now = gmdate(‘Y-m-d H:i:s’);

// value for wait; device
$wait = ’10’; // integer

// https://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_timestampdiff
$device = ‘MINUTE’; //MINUTE, HOUR, DAY, WEEK, MONTH, YEAR

// add SQL-sytax to default $where
$where .= " AND TIMESTAMPDIFF($device, $wpdb->posts.post_date_gmt, ‘$now’) > $wait ";
}
return $where;
}

add_filter(‘posts_where’, ‘publish_later_on_feed’);

[/php]

Spune si tu parerea...