how to display a masonry post based on the taxonomy ID for a custom post type ?
-
Hello, how to display a masonry post based on the taxonomy ID for a custom post type.
This allows to filter directly from a template in the FSE
example :
CPT: skins
Taxonomy: skin
category: page ID
I don’t know if this is understandable.
I tried this but without success:
function filter_post_query( $query_args, $attributes) {
// Modify $query_args values.
overall $post;
// $post->ID is id of current page.
$query_args = array(
‘post_type’ => ‘skins’,
‘posts_per_page’ => 2, // to limit the pages
‘post_parent’ => $post->ID,
);
return $query_args;
}
add_filter( ‘uagb_post_query_args_grid’, ‘filter_post_query’, 10, 2 );
If I remove: ‘post_parent’ => $post->ID,
this shows me all the posts linked to the CPT ‘skins’ when I would like to have just the one in the child category of the ‘skin’ taxonomy.
Basically do like the FSE query loop and Inherit the query from the model
Sorry for my English.
Cordially
- The topic ‘how to display a masonry post based on the taxonomy ID for a custom post type ?’ is closed to new replies.