How To Create A Custom Taxonomy 404 Page

You can filter any type of template to override the template hierarchy. In this case the filter is 404_template. We’ll check if the location query var is set, meaning the URL matched the pattern of a location request, but the result was a 404. In that case, we’ll load the 404-taxonomy-location.php template. function wpd_custom_tax_404( $templates … Read more

Post Object Filter by Custom Field, not title (ACF)

There’s another filter for the post_object: acf/fields/post_object/result, that lets you customise the result (text) displayed for each option in the post object field. Try something like this: function my_post_object_result( $title, $post, $field, $post_id ) { /* Get whatever value you want here e.g. */ $short_title= get_field(‘short_title’, $post->ID); /* do any other processing you might want … Read more

Filter categories of posts with checkboxes

I was able to solve this by using Ajax. First I’ve changed my query args: $args = array( ‘post_type’ => ‘html5-blank’, ‘posts_per_page’ => 5, ‘paged’ => $paged, ‘category_name’ => get_query_var(‘category_name’) ); Then I made template where my content would change by injecting it with Ajax like this: var $vbPosts = $(‘#vb-posts’); var videoCats = { … Read more

How to structure sales of reports [closed]

The closest in my experience was probably working with customizable digital WooComerce products. Users edited the product on site and then purchased the customized version. From technical point of view my implementation did the following: Stored ongoing (before purchase) customizations in user meta On order paid detached customizations from user and transferred them to order … Read more

Hierarchical Custom Post Types – Show only parent on tax archive?

Figured a simple pre_get_posts would do the trick, It will, you just need to query posts that have a parent of 0. Assuming your taxonomy slug/name is literally just region: function wpse_286405_parents_only( $query ) { if ( ! is_admin() && $query->is_tax( ‘region’ ) ) { $query->set( ‘post_parent’, 0 ); } } add_action( ‘pre_get_posts’, ‘wpse_286405_parents_only’ );

Conditional regex in add_rewrite_rule() for specific query filters & pagination

I’ve managed to workaround the problem. He’re the solution for further reference. 1) I have only 1 query var now: function return_vars( $vars ) { $vars[] = ‘filters’; return $vars; } 2) My rewrite rules changed to: add_rewrite_rule( ‘my-base/filters/([^\/]*)/([^&]*)/page/([0-9]{1,})/?’, ‘index.php?post_type=$matches[1]&filters=$matches[2]&paged=$matches[3]’, ‘top’); add_rewrite_rule( ‘my-base/filters/([^\/]*)/([^&]*)/?’, ‘index.php?post_type=$matches[1]&filters=$matches[2]’, ‘top’); Rule 1: handles pagination Rule 2: handles main page only … Read more