• 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’; }

    • This topic was modified 1 week, 3 days ago by Dunos.
    • This topic was modified 1 week, 3 days ago by Dunos.
Viewing 4 replies - 1 through 4 (of 4 total)
  • 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

    The built-in and more capable QUERY LOOP block can do that already.

    Think of the Latest Post block as just a fixed and simplified incantation of the Query Loop block for just POSTs.

    By the time you’re done adding post type filtering (and other features that other users have asked for) to the Latest Post block, you’ve effectively duplicated the Query Loop block ??

    Thread Starter Dunos

    (@dunoss)

    @gappiah Thanks for your respone. I will try with the Query Loop block

    Thread Starter Dunos

    (@dunoss)

    Hi @gappiah

    This doesn’t seem to work if I want to add it in a sidebar position.

    Have any other solutions? Pls

    Thread Starter Dunos

    (@dunoss)

    Hi @gappiah , are you still there?

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.