Dynamic Posts - Query - Custom Query
Updated over a week ago

With this option selected, you can use the custom code for your query.

You can find all the properties and parameters( for Category, Tag, Taxonomy, Search, Post & Page, Password, Post Type, Status, Comment, Pagination, Order & Order by) that you can use in the custom query code here.

Here are few examples:

To show page by its slug (showing blog post with slug 'hello-world' - example.com/hello-world):

return array ( 'name' => 'hello-world' );

To show specific posts using post IDs: (showing specific posts with post IDs: 2, 5, 12, and 14):

return array ( 'post_type' => 'page', 'post__in' => array(2,5,12,14));

To show posts for multiple post types:

return array ( 'post_type' => array( 'post', 'page', 'writer', 'book' ));

To show post by ID (showing post where the post ID is 7):

return array ( 'p' => '7' );

To show posts where Meta key name artist is valued as Lady Gaga and Post Type is 'event'.

return array ( 
'meta_key' => 'artist',
'meta_value' => 'Lady Gaga',
'post_type' => 'event'
);

To show child pages using the Parent Page ID(20 is ID of Parent page in the below code):
โ€‹

return array ( 'post_parent' => '20' );

Did this answer your question?