Custom Query to display posts with custom field

As @jdm2112 implied, WP_Query for your 2nd display is preferred over query_posts. Try using WP Query for your first display as well. It would look something like: <?php $args = array( ‘post_type’ => ‘cars’, // or whatevr the custom post type is ‘post_status’ => ‘publish’, ‘meta_query’ => array( array( ‘key’ => ‘wpcf-featured’, ‘value’ => true, … Read more

How to add custom field to custom taxonomy in 4.4

You can implement this in two ways to add meta boxes through plugin or wordpress predefined hooks https://wordpress.org/plugins/taxonomy-metadata/ **OR** Add the following code in functions.php in your theme function mj_taxonomy_add_custom_meta_field() { ?> <div class=”form-field”> <label for=”term_meta[class_term_meta]”><?php _e( ‘Add Class’, ‘MJ’ ); ?></label> <input type=”text” name=”term_meta[class_term_meta]” id=”term_meta[class_term_meta]” value=””> <p class=”description”><?php _e( ‘Enter a value for this … Read more

how to get archive urls with same origin for custom types and terms?

So, a first solution can be using add_rewrite_rules(). A first raw logic should be something like: 1- get term slugs you need, save in a var, say $terms_string; $terms_string should be a list of pipe-separeted slugs, suitable for regexp, like ‘type1|type2’ etc.. containing ONLY valid (allowed) values. Say use get_terms() to get all the slugs.. … Read more

Setup of taxonomy term template pages

Added this action hook to my functions.php file: add_action( ‘pre_get_posts’, function ( $q ) { if ( !is_admin() // Only target the front end queries && $q->is_main_query() // Targets the main query only && $q->is_tax(‘course-type’) // Only target category pages ) { $q->set( ‘posts_per_page’, -1 ); } }); Then using the default loop on the … Read more