Block Latest Posts: Choose other post type
-
I think the “Latest posts” block should support displaying data from other post types instead of just the post type “post” like it does now, at least give us a hook to be able to do this
this function render_block_core_latest_posts(), please add apply_filters() for $args :
$args = array(
‘posts_per_page’ => $attributes[‘postsToShow’],
‘post_status’ => ‘publish’,
‘order’ => $attributes[‘order’],
‘orderby’ => $attributes[‘orderBy’],
‘ignore_sticky_posts’ => true,
‘no_found_rows’ => true,
);
so we can hook to show other data from our custom post type like:
if( get_post_type() == ‘custom_post_type’) { args[‘post_type’] = ‘custom_post_type’; }
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.