Order custom post type by terms
Order custom post type by terms
Order custom post type by terms
Instead of creating a new query, consider reusing the existing global query: <?php if ( have_posts() ) : ?> <?php while ( have_posts() ) : the_post(); ?> <div class=”container”> Then, to adjust the order, adjust the global query object by hooking into the pre_get_posts hook: /** * Alters the tag archive query to sort ascending. … Read more
Weekly cron is either missing the schedule or triggered too many times on Fridays
The meta_key parameter tells WP_Query to only return posts that have the price_sale_custom meta data. Remove that first, and then change orderby to reference the meta_query values: This is something that WordPress added support for in 4.2: https://make.wordpress.org/core/2015/03/30/query-improvements-in-wp-4-2-orderby-and-meta_query/ https://stackoverflow.com/questions/17745334/how-to-order-by-multiple-meta-keys
This answer for taxonomy terms order by “Category Order and Taxonomy Terms Order” plugin. /** * To add extra param for facet query */ add_filter(‘facetwp_query_args’, function ($query_args, $class) { if ($class->ajax_params[‘template’] == ‘partner_posts’) { $tax_terms = get_terms(array( ‘taxonomy’ => ‘your-taxonomy-name’, ‘fields’ => ‘ids’, ‘hide_empty’ => true, )); $query_args[‘tax_query’] = array( array( ‘taxonomy’ => ‘your-taxonomy-name’, ‘terms’ … Read more
Order by Post Title in WP Query not working
Change woo status automatically [closed]
Need to track the previous job title, and if it’s different, insert your line break. Untested: $prev_job_title = null; while ( $staff->have_posts() ) { $staff->the_post(); $job_title = get_post_meta( get_the_ID(), ‘job_title’, true ); if ( $prev_job_title !== $job_title ) { printf( ‘<h2>%s</h2>’, esc_html( $job_title ) ); $prev_job_title = $job_title; } // Staff markup. }
Admin custom post ordering
How can meta values from another site in a multisite be used in a custom query?