Page with page template not using template in Preview
Page with page template not using template in Preview
Page with page template not using template in Preview
I know it is an old question but im pasting this here in case someone is looking for the same answer. Overloading Template Compatibility theme files Template compatibility also runs a check to see if two directories or folders exist in a theme: ‘buddypress’ ‘community’ If either of these two folders exist in your theme … Read more
I had the same problem. Why WordPress doesn’t automatically use the custom single.php template is above me. That aside, here is the code I’m using to force my CPT to use my custom single.php. Just change the CPT and template name to suite your needs. <?php /* Information Posts Template selection – a single.php just … Read more
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
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
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
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
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.
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
To output your content, It is advised that you pass your content through a filter. get_the_content() does not do this, so it will not for example execute shortcodes or create <p> tags. So, it would be better to use it this way: <?php echo apply_filters( ‘the_content’, wp_trim_words( get_the_content() , 70 ) ); ?> You can … Read more