Search in multiple specific post types

I recently had a similar problem and it had something to do with the query’s posts_per_page parameter. Try setting it explicitly, like so: function custom_search_filter($query) { if ( !is_admin() && $query->is_main_query() ) { if ($query->is_search) { $query->set(‘posts_per_page’, 10 ); // Try setting it to the number you’ve set in the WordPress admin (Settings > Reading). … Read more

custum post inner page not taking single-gallery.php? it redirecting to archive page

get_categories() function retrieves the list of category objects and you’re looping through categories, not the custom posts. So, The code posted here will echo category link, not the individual custom post link. When you haven’t created any custom taxonomy template, It will by default bind it to archive.php you can have more idea about template … Read more

I want to create pagination for my custom post type archive that i am displaying with loop

You Can try this way: add the following before $args if( get_query_var( ‘paged’ ) ): $my_page = get_query_var( ‘paged’ ); else: if( get_query_var( ‘page’ ) ): $my_page = get_query_var( ‘page’ ); else: $my_page = 1; endif; $paged = $my_page; Replace pagination code with this(make sure to add this after endwhile): $total = $projects->found_posts; $page = … Read more

Only show categories that have posts within custom post type

Try Below code: $args = array( ‘post_type’ => ‘work’, ‘posts_per_page’ => -1, ‘post_status’ => ‘publish’ ); $the_query = new WP_Query( $args ); $my_categories = array(); if ( $the_query->have_posts() ) { while ( $the_query->have_posts() ) { $the_query->the_post(); $terms = get_the_terms( get_the_ID(), ‘category’ ); if ( $terms && ! is_wp_error( $terms ) ) : foreach ( $terms … Read more

Add active class to foundation 6 tabs while looping categories

Sure, you can use a counter. Just move your while loop a little higher. Something along these lines: <ul class=”tabs” data-tabs id=”example-tabs”> <?php // counter for ul.tabs $i=0; $bulletin_types = get_object_taxonomies( ‘bulletinboard’ ); foreach( $bulletin_types as $bulletin_type ) : $terms = get_terms( $bulletin_type ); foreach( $terms as $term ) : // increment each one $i++; … Read more