How to get all posts related to particular category name on button click?

How to get category wise all post in WordPress? Add below code in taxonomy-“yourtaxonomyname”.php for ex : file name : taxonomy-event-category.php & Post type : events & taxonomy name : event-category <?php $category_object = get_queried_object(); $category_taxonomy = $category_object->taxonomy; $category_term_id = $category_object->term_id; $category_name = $category_object->name; $category_description = $category_object->description; $category_slug = $category_object->slug; $post_type=”events”; $paged = (get_query_var(‘paged’)) ? … Read more

Advanced search redirecting to another page then filter further

You should use manual sql queries to fetch the records as per your customized requirement and filters rather than the query function. Otherwise install a plugin that creates advanced search form with filters. I am also sharing a reference link below which might be useful for you: http://www.wpbeginner.com/wp-tutorials/how-to-create-advanced-search-form-in-wordpress-for-custom-post-types/ If none of it helps, do mention … Read more

Display children category images

Haven’t tested it, but this should do it. <?php $term = get_term_by( ‘slug’, get_query_var( ‘term’ ), get_query_var( ‘taxonomy’ ) ); $queried_object = get_queried_object(); $term_id = get_queried_object() -> term_id; $taxonomyName = “product-categories”; $termchildren = get_term_children( $term_id, $taxonomyName ); if (! empty ( $term_children ) ){ foreach ($termchildren as $child) { $image_id = get_term_meta( $child, ‘showcase-taxonomy-image-id’, true … Read more

Clean Custom URL for Serach + Custom Taxonomy

With Slam’s kind tip to use query-monitor plugin, I could figure out what the problem was. Apparently the url /search/foo/filter/bar also fits the “general search” rewrite-rule. Makes sense, thinking about it– (.+) technically matches /foo/filter/bar aswell. So I could improve (.+) by excluding /s? But I found an easier solution! In hope “first match wins” … Read more

Custom post type and custom taxonomy 404 on page 2

So after many trials and errors, I found I had to create a specific rewrite rule to go into my functions.php, one that handles post type ‘videos‘ and the category (taxonomy) ‘videos_category‘: add_filter(‘init’, function() { add_rewrite_rule( ‘^videos/([^/]*)/([^/]*)/(\d*)?’, ‘index.php?videos_category=$matches[1]&p=$matches[2]&paged=$matches[3]’, ‘top’ ); }); I also found this plugin to be really helpful for viewing my rewrite rules: … Read more