string ucfirst ( string $str )
Returns a string with the first character of str capitalized, if that character is alphabetic.
Therefore, you can do:
string ucfirst ( string $str )
Returns a string with the first character of str capitalized, if that character is alphabetic.
Therefore, you can do:
After transfering a WordPress.com blog to a provite domain, I noticed that I couldn’t, for the life of me, get the correct comment count to show. Funny thing was that my if (have_comments ()) statement was returning true, and the comments were in fact displaying. My theme was depending on get_comments_number() to return correctly so
<h3 id="comments-title"><?php printf( _n( 'One Response to %2$s', '%1$s Responses to %2$s', get_comments_number(), 'woothemes' ), number_format_i18n( get_comments_number() ), '<em>' . get_the_title() . '</em>' ); ?></h3>
would return something like “6 RESPONSES TO FOUR WAYS I’M DOING FLOWERS RIGHT NOW.” Instead all I saw was
Sometimes when you’re customizing a WordPress theme with tons of templates, its not always obvious which one is responsible for the output you see. You don’t always want to rack your brains over the template hierarchy, nor do you want to edit every page just to see what’s in the drop-down.

Here’s a quick-and-dirty way to spit out filename of the template used in your current view:
Man, I hate deadbeat stackoverflow users. But a useful question (and answer) I think: http://stackoverflow.com/questions/5923388/displaying-wordpress-page-number-count-in-relation-to-siblings
Here’s a quick recipe for use on child pages. Works in your sidebar or template. This tells you that you are on page X of Y out of the child pages of a particular parent.
To be used on a category/archive page in WordPress. Outputs all the tags used in all the posts in the category.
<?php
// get the category ID of whatever category we are looking at the archives of
$category_id = get_query_var('cat');
// get the ids of all the posts in the cat
$post_ids = get_objects_in_term( $category_id, 'category' );
// get all the tags from these posts
$tag_ids = wp_get_object_terms( (array) $post_ids, 'post_tag', array('fields' => 'ids') );
$tag_param = '';
if ( ! empty($tag_ids) ) {
//change 'include=' to 'exclude=' to achieve the opposite..
$tag_param = 'include=' . implode(',', (array) $tag_ids );
}
//format the output using wp_tag_cloud parameters see:
//http://codex.wordpress.org/Function_Reference/wp_tag_cloud#Parameters
wp_tag_cloud('count=0&order=RAND&smallest=8&largest=22&'.$tag_param); // don't forget to tack on your includes
?>
Note that you can also pass this to get_tags(), which you can use to roll your own list of links. For instance, I recently did something like:
$tags = get_tags('orderby=count&order=DESC&'.$tag_param); //beware params are not all the same
$html = '<div id="port-tags">';
foreach ($tags as $tag){
$tag_link = get_tag_link($tag->term_id);
$html .= "<a href='{$tag_link}' title='{$tag->name} tag' class='{$tag->slug}' data-filter='.tag-{$tag->slug}'>";
$html .= "{$tag->name}</a>";
}
$html .= '</div>';
echo $html;
This is not super well documented, and can frustrate the dickens out of you if you’re trying to get it to do some heavy image lifting outside of what your Woo Theme is programed to do out of the box. Took me a while just to find this sucker. It is located in /wp-content/themes/your_theme/functions/admin-functions.php
I was just editing our wedding blog, which pulls in flickr albums for perusal. The plug-in I was using output the first 5 most recent albums in a fancy format, and showed the remaining in less fancy way. This was great as we added wedding albums, but as we continued to use the flickr account post-nuptials, now the page is now clogged with vacation pics, etc. And the wedding pics are lost at the bottom, un-fancified.
The plugin slurps in an array of flickr album ids, and does its magic. Now I want it to only consider the first (oldest) 7 albums, before it sorts as above (latest 5 are stylin’ etc). Rather than rewrite the plugin or hardcode album ids into an array, I just wanted to dump everything newer than those initial 7. How?
array_splice() it out.