How can I display an archive of only one category of my custom post type?

Try this and let us know if it works: function custom_category_rewrite() { /** * Here you build an array containing the post type keys that you want * the rule to work for. */ $custom_post_types = array(‘podcast’); foreach ( $custom_post_types as $post_type ) { /** * Adds rewrite rule which will rewrite sth like http://yoursite.com/podcast/category/category-name/ … Read more

Change term name only on front

You can detect if you are in the frontend using the function is_admin(), like so: add_filter(‘get_term’, ‘filter_term_name’, 10, 2); function filter_term_name($term, $taxonomy) { // return the term untuched if you are in the admin if( is_admin() ) { return $term; } if ($taxonomy == ‘my-taxonomy’) { // numeric value of term in another taxonomy $meta_value … Read more

Custom page template for category taxonomy

The hierarchy for custom taxonomies is: taxonomy-$taxonomy-$term.php taxonomy-$taxonomy.php taxonomy.php archive.php index.php So, if your taxonomy was called cats, you could target that specific taxonomy with a template file taxonomy-cats.php. If you wanted to style your tabby cats differently than the rest (because of course you would), then you could use taxonomy-cats-tabby.php. See wphierarchy.com

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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)