Query by 2 values of a repeater ACF field

I know this is an old question, but I thought I’d post the answer in case anybody else is facing the same problem. functions.php: function add_cond_to_where( $where ) { //Replace showings_$ with repeater_slug_$ $where = str_replace(“meta_key = ‘showings_$”, “meta_key LIKE ‘showings_%”, $where); return $where; } add_filter(‘posts_where’, ‘add_cond_to_where’); Query: //Replace showings_$ with repeater_slug_$ //Replace _discounts with … Read more

Custom taxonomy archive page not working

Your permalink as given is domain.com/curriculum-area/equality but you registered your taxonomy as Curriculum Area. For domain.com/curriculum-area/equality to work, change Curriculum Area in: register_taxonomy( ‘Curriculum Area’, ‘course’, $args_curriculum_area_taxonomy ); to be: register_taxonomy( ‘curriculum-area’, ‘course’, $args_curriculum_area_taxonomy ); Also change this line ‘taxonomies’ => array( ‘curriculum_area’ ), to ‘taxonomies’ => array( ‘curriculum-area’ ), I forgot to say, remember … Read more

List all posts in Custom Post Type but group dynamically by Custom Taxonomies

Try this piece of code for page template. I’ve used it on one of my projects. It outputs taxonomy term one by one with list of all posts with this term. (Just replace YOUR_TAXONOMY_SLUG to yours) <div id=”content”> <h2 class=”entry-title”><?php the_title(); ?></h2> <div id=”post-<?php the_ID(); ?>” <?php post_class(); ?>> $mytaxonomy = get_terms(‘YOUR_TAXONOMY_SLUG’, array(“fields” => “names”)); … Read more

Alphabetical sorting of custom post type – one letter per page

Building the navigation is pretty straight forward. You have a few possibilities afterwards, I’d suggest you build one page template and use a GET-parameter to sort it out. using a GET variable Your Links in the navigation would be like: http://www.example.com/yourpage?letter=a In the page template you make a simple query in the wpdb. global $wpdb; … Read more

custom sortable column

I fixed this issue by changing some of my code. I changed: add_filter( ‘request’, ‘timeline_column_orderby’ ); function timeline_column_orderby( $vars ) { if ( !isset( $vars[‘orderby’] ) || ( isset( $vars[‘orderby’] ) && ‘Year’ == $vars[‘orderby’] ) ) { $vars = array_merge( $vars, array( ‘meta_key’ => ‘timeline_date’, ‘orderby’ => ‘meta_value’ ) ); } return $vars; } … Read more

Show all custom post type posts sorted by custom taxonomy then by another custom taxonomy

First get a list of categories and a list of locations. Then loop through each category. Within each category loop through the list of locations and query posts that have the current category and the current location and output the list: $categories = get_terms( array( ‘taxonomy’ => ‘shop_category’, ) ); $locations = get_terms( array( ‘taxonomy’ … Read more