one category template for multiple categories

First paste this code in your theme’s functions.php function post_is_in_descendant_category( $cats, $_post = null ){ foreach ( (array) $cats as $cat ) { // get_term_children() accepts integer ID only $descendants = get_term_children( (int) $cat, ‘category’); if ( $descendants && in_category( $descendants, $_post ) ) return true; } return false; } then on your category.php or … Read more

How to have dynamic sidebar content per post

take a look at Sidebar Generator it lets you specify a sidebar on a per-page/per-post basis. some of its main features are: Generate unlimited sidebars pick a sidebar on a per-page and per-post basis unique CSS classes for each sidebar for customizable looks

Using custom post template

$cat->1176 cannot be a property of an object. PHP Manual: A valid variable name starts with a letter or underscore, followed by any number of letters, numbers, or underscores. As a regular expression, it would be expressed thus: ‘[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*’ Use $cat->term_id and compare it’s value with the number you’re out for. And … don’t use … Read more

Remove WordPress scripts

What Theme are you using? Your question is entirely Theme-dependent, so specific answers will requiring knowing what Theme you use. (Also, it would be helpful to know if any of your Plugins are injecting scripts.) The answer really depends on how those scripts and scripts are called. If they are called properly, they are registered … Read more

Getting template_include to work when allow_url_include is off?

Wouldn’t ya know – 10 minutes or less since I asked my question and I’ve discovered the answer. I was attempting to define MY_PLUGIN_TEMPLATES using using plugins_dir_url(), now it looks like this and is working: define( ‘MY_PLUGIN_TEMPLATES’, dirname( __FILE__ ) . ‘/templates’ ); Thanks to mfields for the suggestion of dirname instead of WP_PLUGIN_DIR.

How to have two different versions of a tag/category/taxonomy archive page?

My solution at the moment is to use a GET variable to request a different page template: Regular version of taxonomy page: mysite.com/subjects/science Blog version of taxonomy page: mysite.com/subjects/science?view=blog To handle the ?view=blog variable, I add this conditional to the top of taxonomy.php (or taxonomy-subjects.php and any other taxonomy-{slug} that I want to have an … Read more