Create separate template for shared custom taxonomy with shared terms

See, It’s quite difficult to have path like site/books/product_category/horror/ site/movies/product_category/horror/ As wordpress functionality will conflict between custom_post_type & their taxonomy if try to keep url like you mentioned. I suggest you consider the I mentioned below as a solution of your problem. site/product_category/horror/?post_type=books site/product_category/horror/?post_type=movies Now to keep template as per shared terms, Create two templates … Read more

How do you modify Page Template?

All code will be in the template. That is how custom templates work. Altering the output those templates is a code edit except where the templates have been written to include the post body, or meta fields, etc. But don’t go to Appearance->Editor and start hacking away. First, if this isn’t your theme you are … Read more

Custom taxonomy template not working

First of all, a taxonomy-{taxonomy}.php file is an Archive Template and not a good name for a custom template. So if you want to proceed with a custom template, try naming the file with something like template-cities.php and call the file to a Page. Otherwise, make a simple taxonomy-{taxonomy}.php archive template, and in your case … Read more

Can I obtain differents links for different installed theme?

I’ve done for this myself using the plug-in theme switcher: http://wordpress.org/plugins/theme-switcher/ (yes, it hasn’t been edited in 2+ years). These theme stores a cookie in the browser indicating which theme the user has selected (themes are displayed as a drop-down / link list widget – and selecting a theme changes the cookie and redirects you … Read more

Why is custom template not seen as page with is_page()?

When you call query_posts($query); in your second template, you overwrite the global variable that WordPress uses to return the correct values for the is_ conditionals. You should basically never use query_posts in the template. For secondary loops, use a new instance of WP_Query instead.

Custom url structure for custom template

In the link you attached, you have everything you need. You should: add query variable (e.g operators_actv), add rewrite rule that sets this variable (operators_actv), use the template_include action hook to load custom template if query variable operators_actv is set. Code: add_filter( ‘query_vars’, ‘se332319_custom_query_vars’ ); add_filter( ‘template_include’, ‘se332319_custom_template’, 50 ); add_action( ‘generate_rewrite_rules’, ‘se332319_resources_cpt_generating_rule’ ); function … Read more

Include different loop templates in search query

I would recommend using content-{posttype}.php method, where you only have HTML markup, template tags for posts or custom post types and leave loops outside of those files. See Twenty Eleven for more detailed example. After this change you can easily modify search.php and include specific content markup based on post type. if ( have_posts() ) … Read more

Exclude pages with certain template from wp_list_pages

Daniel, exclude parameter doesn’t accept array. Use your code this way: $exclude = []; foreach(get_pages([‘meta_key’ => ‘_wp_page_template’, ‘meta_value’ => ‘page-templates/page-noindex.php’]) as $page) { $exclude[] = $page->post_id; } $args = array( ‘exclude’ => implode(“,”, $exclude), ‘title_li’ => ”, ‘sort_column’ => ‘menu_order, post_title’, ‘post_type’ => ‘page’, ‘post_status’ => ‘publish’ ); wp_list_pages($args); I think you can refactor it … Read more

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