Taxonomy, Terms, and Template Files

These types of URLs are supported since WP 3.1: register_taxonomy( ‘types’, ‘post’, array( ‘hierarchical’ => true, ‘rewrite’ => array( ‘hierarchical’ => true ), … ); Remember to flush the rewrite rules after making the change. The template you would use for both parent and child terms is taxonomy-types.php: $current_term = get_queried_object(); if ( 0 == … Read more

Post/Page Preview Template

You could use the conditional is_preview() to add a bit of extra content. For instance, you could put this at the very top of your single.php right after the header is called – or you could put it in your header.php file if you want it shown at the very top of the page: <?php … Read more

Custom Taxonomy Archive Page

That is how taxonomies works by default in WordPress. There is not an archive page for “All posts that belongs to any term of a taxonomy”. And, conceptually, it is correct. Imagine you want to list all items of a biological taxonomy system: that is listing all organisms. If you translate to posts, it is … Read more

Why do templates contain so many PHP tag pairs?

As always, people copy paste whatever they learned from and IIRC the first style is the coding style of wordpress core. As you said yourself, when there is a big block of generated HTML it is easier to look at (and balance tags) under the first style, but pragmatic people will use the second whenever … Read more

View WordPress page template usage (or unused)

What you need to do is compare the values of the meta field _wp_page_template, which contains the page template selected for a single page with the available page templates. For this you need to construct an array of used templates, because you want the templates used by all the pages, similar as shown here: Return … Read more

Can’t get a custom template taxonomy page to display

I found this code; function ftc_flush_rewrites() { global $wp_rewrite; $wp_rewrite->flush_rules(); } function ftc_add_rewrites() { global $wp_rewrite; $ftc_new_non_wp_rules = array( ‘find/(this)’ => ‘/addit.php?here=$1’, ); $wp_rewrite->non_wp_rules = $ftc_new_non_wp_rules + $wp_rewrite->non_wp_rules; } add_action(‘generate_rewrite_rules’, ‘ftc_add_rewrites’); add_action(‘admin_init’, ‘ftc_flush_rewrites’); in this thread http://wordpress.org/support/topic/writing-wp_rewrite-gtnon_wp_rules-to-htaccess …not sure if that addresses the problem but good luck!

WooCommerce: Change template for single product page

Woo Commerce is off topic as its a plugin and not specifically related to WordPress but what you can do is copy over the single-product.php template to a WooCommerce folder in your child theme. change the file name and modify the file, then use single_template or template_include with the correct conditional tag. single_template function get_custom_post_type_template($single_template) … Read more

How to force TinyMCE in WordPress to replace newlines with tags and not with  

The answer suggested by GavinR is correct. You don’t need to install the suggested plug-in, though. Just add this mini plugin and you’re set: <?php defined( ‘ABSPATH’ ) OR exit; /* Plugin Name: TinyMCE break instead of paragraph */ function mytheme_tinymce_settings( $tinymce_init_settings ) { $tinymce_init_settings[‘forced_root_block’] = false; return $tinymce_init_settings; } add_filter( ‘tiny_mce_before_init’, ‘mytheme_tinymce_settings’ ); Now … Read more

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