WordPress subcategories return 404 in custom template

I have seen the magic “.” break a lot of sites paginations and do errors to such issues as yours (return status 404 for subcategories). Try installing a plugin named “WP No category base” (link below) and remove that dot from the category base. Save permalinks a few times after installing plugin and hope that … Read more

Change archive page template using pre_get_post

You corrected the filter hook name from archive-videos to template_include, but in the first function return $query; statement comes before add_filter(), so the filter is not added. add_action( ‘pre_get_posts’ ,’post_type_videos’ ); function post_type_videos( $query ) { if ( ! is_admin() && $query->is_post_type_archive( ‘videos_cpt’ ) && $query->is_main_query() ) { $query->set( ‘post_type’, ‘videos’ ); //set query arg … Read more

How to test pagination? [closed]

The homepage and all archive pages (date, category, tag, taxonomy and author pages ) uses the same default pagination functions for pagination. What this means is, the_posts_pagination works on all archive pages and the home page. The only differences on these pages is the content which is determined by the main query. As far as … Read more

Custom Taxonomy Archive BUG

as mentioned by @mmm you loop over the terms and in each term you loop over each project – however I think this is what you wanted to do: $terms = get_terms( array( ‘taxonomy’ => ‘residential_project_types’, ‘orderby’ => ‘count’, ‘hide_empty’ => true ) ); foreach( $terms as $term ) : ?> <a class=”property-thumb-link” href=”https://wordpress.stackexchange.com/questions/264897/<?php echo … Read more

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

creating custom archive template within plugin for custom post type using archive_template filter

I was able to get it working as desired using the condition is_archive() && get_post_type($post) == ‘product’. I also created a custom taxonomy for products as product-category below is the code: function get_custom_post_type_template( $archive_template ) { global $post; $plugin_root_dir = WP_PLUGIN_DIR.’/product-plugin/’; if (is_archive() && get_post_type($post) == ‘product’) { $archive_template = $plugin_root_dir.’/inc/templates/archive-product.php’ } return $archive_template; } … Read more

Archive slider for CPT

The slider script is called with the following lines of code if ( is_front_page() && ‘slider’ == get_theme_mod( ‘featured_content_layout’ ) ) { wp_enqueue_script( ‘twentyfourteen-slider’, get_template_directory_uri() . ‘/js/slider.js’, array( ‘jquery’ ), ‘20131205’, true ); wp_localize_script( ‘twentyfourteen-slider’, ‘featuredSliderDefaults’, array( ‘prevText’ => __( ‘Previous’, ‘twentyfourteen’ ), ‘nextText’ => __( ‘Next’, ‘twentyfourteen’ ) ) ); } You just need … Read more