Add User Types to WordPress and BuddyPress

Posted by on Aug 8, 2010 in Articles, How-To | 45 comments

There is a new version of this code located at Please use that code and leave all comments on that page. I’ve been working on some more complicated sites than usual at work. One is a social networking site that uses BuddyPress. It’s my first BuddyPress site, so it’s been a learning experience. Additionaly, it was my first WordPress Multi-Site. One thing I needed to do was allow people to choose a user type at registration. I also needed the user to be assigned a custom Role based on their user type. I...

Read More

Show number of posts in a category

Posted by on Jan 22, 2010 in Articles, How-To | 1 comment

Tonight I needed to figure out how to display the number of posts that were in a specific category. This post on Getting the number of posts per category showed me how to do that. This goes into your template where you want the number to appear: <?php echo get_category_by_slug('category-slug')->category_count; ?> Replace category-slug with the slug of your category.

Read More

Replacing Core Functions

Posted by on Jan 10, 2010 in How-To | 0 comments

Replacing template core functions is easy and doesn’t require editing core files. Copy the code for that function to functions.php in your theme, change the function name, and call it in your template using it’s new name.

Read More

Yearly Archives

Posted by on Jan 10, 2010 in Articles, How-To | 0 comments

Place the following in functions.php to list the archives for a specific month and year: function getarchives_filter($where, $args) { if (isset($args['year'])) { $where .= ' AND YEAR(post_date) = ' . intval($args['year']); } if (isset($args['month'])) { $here .= ' AND MONTH(post_date) = ' . intval($args['month']); } return $where; } add_filter('getarchives_where', 'getarchives_filter', 10, 2); This is what you will add to your template file: <?php wp_get_archives('type=daily&month='.get_the_time('m').'&year=' . get_the_time('Y')); ?> If you’ve been blogging for a number...

Read More