Using a different template per Custom Taxonomies for single term archive pages

I would intercept the template loader at template_redirect: function wpse53892_taxonomy_template_redirect() { // code goes here } add_action( ‘template_redirect’, ‘wpse53892_taxonomy_template_redirect’ ); Then, you would check to see if the query is a custom taxonomy: if ( is_tax() ) { // This query is a custom taxonomy } Next, get the term object, and find out if … Read more

/images/image.jpg not working in sidebar

PHP code won’t run inside of a text widget. There are plugins that will let you do that, but this type of thing is strongly discouraged. Add this code to your functions.php file, or better yet, make it a simple little plugin: // Enable the use of shortcodes within widgets. add_filter( ‘widget_text’, ‘do_shortcode’ ); // … Read more

Using “setup_postdata” with “get_template_part” does not work

For those who aren’t creating a query with get_posts() you may need to reference the global $post variable first before using setup_postdata(). Here is an example shortcode using a foreach loop and iterating through an array of post objects from an ACF Relationship field: function your_shortcode() { //reference global $post first global $post; $featured_posts = … Read more

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