function _wp_blog__get_blog_posts in WP Blog - a WordPress-style blogging module. 7
Fetch the nid and created-date of all published blog-posts.
Return value
array An array of objects, each with the property nid and created, sorted by creation-time (new to old).
1 call to _wp_blog__get_blog_posts()
- _wp_blog_get_blog_archive_tree in ./
wp_blog.module - Build a data tree of all published blog posts, with their year, month, and post-counts.
File
- ./
wp_blog.module, line 324 - WP Blog provides a content-type, taxonomy vocabulary, views and various features to mimic a WordPress-style blog.
Code
function _wp_blog__get_blog_posts() {
$blog_posts =& drupal_static(__FUNCTION__, NULL);
if (is_null($blog_posts)) {
// Query for WP blog nodes which the current user has access to.
$blog_posts = db_select('node', 'n', array(
'target' => 'slave',
))
->fields('n', array(
'nid',
'created',
))
->condition("n.type", WP_BLOG_DEFAULT_CTYPE)
->condition("n.status", NODE_PUBLISHED)
->orderBy("n.created", 'DESC')
->addTag('node_access')
->execute()
->fetchAll();
}
return $blog_posts;
}