Custom post type archive page not showing on archive-posttype.php

Custom template should be archive-gallery.php instead of archive-posttype.php It’s archive-$posttype.php where $posttype is the custom post type slug. WordPress first looks for archive-$posttype.php and if it’s not available then chooses archive.php Update Same for the custom taxonomies also , the flow is: taxonomy-$taxonomy-$term.php –> taxonomy-$taxonomy.php –> taxonomy.php –> archive.php So for gallery_categories custom taxonomy use … Read more

Rewrite rule pagination on different url levels

I have added extra rewrite rules for pages with no item_width and item_height in combination with pagination as follows: /** * Adds rewrite rules for shop category */ function gtp_add_shop_rewrite_rules() { // shop-category/category/item_width/item_height/page/2/ add_rewrite_rule( ‘^shop-category\/([^/]*)\/([^/]*)\/([^/]*)\/page\/([0-9]*)$’, ‘index.php?shop-category=$matches[1]&item_width=$matches[2]&item_height=$matches[3]&paged=$matches[4]’, ‘top’ ); // shop-category/category/page/2/ add_rewrite_rule( ‘^shop-category\/([^/]*)\/page\/([0-9]*)$’, ‘index.php?shop-category=$matches[1]&paged=$matches[2]’, ‘top’ ); // /shop-category/category/item_width/item_height/ add_rewrite_rule( ‘^shop-category\/([^/]*)\/([^/]*)\/([^/]*)$’, ‘index.php?shop-category=$matches[1]&item_width=$matches[2]&item_height=$matches[3]’, ‘top’ ); // /shop-category/category/item_width/ add_rewrite_rule( … Read more