How to show terms used only for particular custom post type. Filter creation perpose

You need to send param post_id in ajax of data. Then in your plugin parse it and and search by taxomony. My simple example: <?php // in ajax handler // get post_id from requst data $post_id = filter_var($_POST[‘post_id’], FILTER_VALIDATE_INT); // find post $post = get_post($post_id); But before you need register the taxomony. register_taxonomy(‘auto’, array($post->post_type), array( … Read more

Include only one category but Exclude if is in a category from loop

You would use multiple arrays in the tax_query and make sure you use the AND relation so it combines them, like so: $q->set( ‘tax_query’, array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘product_cat’ ‘field’ => ‘slug’, ‘terms’ => ‘CAT A’, ‘operator’ => ‘IN’ ), array( ‘taxonomy’ => ‘product_cat’ ‘field’ => ‘slug’, ‘terms’ => ‘CAT B’, ‘operator’ … Read more

Custom post type loop without children

please add your Custom post type name here ‘post_type’ => ‘Services’, // required <?php $args=array( ‘post_parent’ => 0, // required ‘post_type’ => ‘Services’, // required ‘orderby’ => ‘menu_order’, // to display according to hierarchy ‘order’ => ‘ASC’, // to display according to hierarchy ‘posts_per_page’ => -1, // to display all because default is 10 ); … Read more

pages shortcode filtering by category

ob_start() This function will turn output buffering on. While output buffering is active no output is sent from the script (other than headers), instead the output is stored in an internal buffer. ob_get_clean() Gets the current buffer contents and delete current output buffer. try this code function qut_research_subpages_shortcode_frontend($atts) { $args = array( ‘post_type’ => ‘page’, … Read more