<?php
$args = array(
'post_type' => 'custom_post_name',
'post__not_in' => array(1,2,3),
'order' => 'ASC',
'posts_per_page' => 3,
'tax_query' => array(
array(
'taxonomy' => 'custom_taxonomy_category',
'field' => 'id', //slug, id, name
'terms' => array( 1,2,3),
'operator' => 'NOT IN' //IN, NOT IN
),
)
);
Custom post has been a very useful capability in WordPress. It makes it much more easier to organise custom content in WordPress as a CMS.
For custom post, we can use tax_query to filter unwanted categories or display custom post of certain categories. It's fully configuration and you can combine multiple query too.
For custom post, we can use tax_query to filter unwanted categories or display custom post of certain categories. It's fully configuration and you can combine multiple query too.
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.