How-To

WordPress Gallery with Categories

Posted by on Jan 2, 2012 in Articles, How-To | 1 comment

Recently I needed to recreate a specific gallery format in WordPress. There are probably better ways to go about it, such as custom post types, but I needed something quick and easy. The main gallery page needed to have a list of “categories” that were represented by images. I used a WordPress Page that consisted of: [gallery size="full" link="custom_url"] Each “category” was an image that linked to a WordPress Page. On the category pages, for each gallery item, there needed to be a caption on top of the image, the image with no link, and a...

Read More

Updated BuddyPress User Roles Code

Posted by on Jan 27, 2011 in Articles, How-To | 14 comments

My post on adding user types to WordPress and Buddypress has been very popular. This code will soon be available as a plugin. I’ve updated the code so it’s cleaner and easier to implement. This code also works with or without allowing users to add new sites. This only works for BuddyPress running on the multisite version of WordPress. If you’re using the regular version, someone else has a plugin available for that: WP Roles at Registration. It works for BuddyPress (but not the multisite version). Instructions Set up your custom WordPress roles using Capability Manager or a...

Read More

User Types in BuddyPress – Assign xprofile Groups

Posted by on Oct 13, 2010 in Articles, How-To | 16 comments

As requested by Janis, here is the code I use to show only certain xprofile groups to each user type. In the default BuddyPress theme, profile fields without a value aren’t shown, so only the ones for that group will appear to the public. You will need to replace a function call in your BuddyPress theme, in /members/single/profile/edit.php. It is at line 12 in mine. Find <?php bp_profile_group_tabs(); ?> And replace it with this: <?php my_bp_profile_group_tabs(); ?> In /plugins/bp-custom.php place the following code. You will need to edit it to fit your user type and...

Read More

Adding User Types to WordPress and BuddyPress – with User Blogs

Posted by on Oct 13, 2010 in Articles, How-To | 6 comments

There is a new version of this code located at http://cleverness.org/2011/01/27/updated-buddypress-user-roles-code/. Please use that code and leave all comments on that page. I’ve previously talked about adding user types to BuddyPress. I’ve found out recently that if you allow new users to create their own blogs, you will need to add the following code to your functions.php file. function synchro_wp_usermeta_blog($blog_id, $user_id, $domain, $path, $site_id, $meta) { global $bp, $wpdb; $type = $meta[signup_type]; update_usermeta( $user_id, 'signup_type', $type ); } add_action(...

Read More

Get Categories Author has Posted in for Custom Post Types

Posted by on Aug 21, 2010 in Articles, How-To | 3 comments

I needed to list all the categories of a custom post type that an author had posted in. I found code to do that with regular posts in the wordpress.org forums and I modified it to use with custom post types. Be sure to replace custom_taxonomy with the name of your taxonomy. Place this into your theme file where you want the list to appear. <?php $author = get_the_author_meta('ID'); $categories = $wpdb->get_results(" SELECT DISTINCT(terms.term_id) as ID, terms.name, terms.slug FROM $wpdb->posts as posts LEFT JOIN $wpdb->term_relationships as relationships ON posts.ID =...

Read More

Limit Number of Posts Per User in WordPress

Posted by on Aug 13, 2010 in How-To | 11 comments

This code will limit the number of posts a user can make. At first, I was trying to limit each user to one post and I had that working. Then I realized that I needed to have different numbers of posts for different users, so I created an option in a user’s profile that only people with the right capability (manage_options) can edit. I’ll be changing this in the future for that number to be automatically changed depending on a user’s subscription type, but I needed this for testing purposes. The option in the profile shows up under the contact info section, which I know is...

Read More