Search

עיכוב פרסום הפוסטים ב RSS Feed

אני מעוניין לעכב את הפרסום ב RSS Feed של הפוסטים שאני כותב ב 10-15 דקות מכיוון ותמיד אני מגלה מספר טעויות לאחר הפרסום. סיטואציה נוספת היא מצב בו אני מעוניין שתוכן האתר יהיה אקסלוסיבי למשך זמן מסויים ולא יופיע באותו RSS פיד.

// Delay feed update
function publish_later_on_feed($where) {
    global $wpdb;

    if (is_feed()) {
        // Timestamp in WordPress format
        $now = gmdate('Y-m-d H:i:s');

        // Value for wait; + device
        $wait = '10'; // integer

        // http://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 syntax to default $where
        $where .= " AND TIMESTAMPDIFF($device, $wpdb->posts.post_date_gmt, '$now') > $wait ";
    }
    return $where;
}
add_filter('posts_where', 'publish_later_on_feed');
מצאתם טעות בקוד? הסניפט לא עובד לכם? רישמו לי בתגובות ואני מבטיח לטפל בכך במהרה ולספק סניפט תקין...
0 תגובות...

תגובה חדשה

Up!
לבלוג