Modify Global Posts Plugin

时间:2012-05-30 作者:Chris Collins

我正在尝试修改来自wpmudev的一个名为global blog posts的查询。我需要它不显示任何默认的博客帖子,每个博客上的第一篇帖子。

$query = "SELECT * FROM " . $wpdb->base_prefix . "site_posts 
WHERE blog_public = \'1\' 
AND post_type =\'" . $recentglobalpoststype . "\' 
ORDER BY post_published_stamp 
DESC LIMIT " . $recentglobalpostsnumber;
我需要抑制每个博客中的默认博客帖子。任何想法,我都试过了

$query = "SELECT * FROM " . $wpdb->base_prefix . "site_posts 
WHERE blog_public = \'1\' 
AND post_type =\'" . $recentglobalpoststype . "\' 
AND ID <> 1 
ORDER BY post_published_stamp 
DESC LIMIT " . $recentglobalpostsnumber;

1 个回复
SO网友:Bruce Pearson

是否可以使用SQL OFFSET语句:

偏移量1

$query = "SELECT * FROM " . $wpdb->base_prefix . "site_posts 
WHERE blog_public = \'1\' 
AND post_type =\'" . $recentglobalpoststype . "\' 
ORDER BY post_published_stamp 
OFFSET 1
DESC LIMIT " . $recentglobalpostsnumber;

结束