Fastest way to get the comment and ping total count for a post

you can use this custom function in the functions.php of the theme: /** * count for trackback, pingback, comment, pings * * embed like this: * fb_comment_type_count(‘pings’); * fb_comment_type_count(‘comment’); */ if ( !function_exists(‘fb_comment_type_count’) ) { function fb_get_comment_type_count( $type=”all”, $zero = false, $one = false, $more = false, $post_id = 0) { global $cjd_comment_count_cache, $id, $post; … Read more

WordPress theme options and insert default value for serialize data

Loop over your array of options and generate a set of defaults from that.. Let’s imagine your array looks something like this.. (but obviously bigger).. $your_options = array( array( ‘name’ => ‘option-one’, ‘desc’ => ‘Option one description’, ‘type’ => ‘text’, ‘std’ => ‘default_value’ ), ..and so on.. for each option.. ); First check if you … Read more

Using if/else statements with output from theme options

There’s no need to be using _e() that’s for text that’s to be translated, you don’t translate CSS, it only comes in one language… With regard to your if/else’ing, try this.. <?php $options = get_option(‘mytheme_theme_options’); if( isset( $options[‘linkcolour’] ) && ( !empty( $options[‘linkcolour’] ) ) ) printf( “a, a:link {color: #%s;}”, $options[‘linkcolour’] ); ?> Here’s … Read more

How to move all theme templates into a subfolder WP

Not easy to do. You can create redirect template and assign templates based on page ID <?php if (is_page(‘629’)) { include(TEMPLATEPATH . ‘/pages/homepage.php’);} elseif (is_page(‘186’)) { include(TEMPLATEPATH . ‘/pages/generalpage.php’);} else { include(TEMPLATEPATH . ‘/pages/defaultpage.php’); } ?> See this for more details