bp-shortcodes

A while back I thought about ways to make BuddyPress integrate with the regular posts and pages within WordPress better. I had no idea to properly display BuddyPress information in posts, sidebar or templates. So I came up with the idea to use WordPress Shortcodes to display BuddyPress related content anywhere.

Download Bowe Codes (BuddyPress Shortcodes)

So I approached iMath on Twitter can after some short Tweets send him a document containing all the shortcodes and their configuration options I had in mind. In record time he started worked on it, and decided to name the plugin after yours truly! I can die a happy man now.

So who is iMath anyway? Let’s use a shortcode and pull in his BP-Tricks information!

[bc_member name=”imath” size=”100″ fields=”About me,Website,Twitter Name”]

Shortcode used: bc_member name=”imath” size=”100″ fields=”About me,Website,Twitter Name”

It goes without saying that this makes creating custom BuddyPress related pages, widgets and even templates so much easier!

Available BuddyPress Shortcodes

Currently there are 10 shortcodes available:

  • Member: Display a specific member
  • Group: Display a specific groups
  • Members: A list of members
  • Groups: Displays a certain amount of groups
  • My Friends: Displays friends of the displayed or logged in user
  • My Groups: Displays groups of the displayed or logged in user,
  • My Messages: Shows messages and the notifications of a logged in user,
  • MultiSite Blogs: Allows you to show certain Blogs from your MultSite network
  • MultiSite Posts: Displays specific posts from your MultiSite Network

Installation

You can download and install The BoweCodes plugin using the built in WordPress plugin installer. Or you can also download the plugin manually:

Download Bowe Codes (BuddyPress Shortcodes)

note: make sure it is uploaded to “/wp-content/plugins/bowe-codes/” Renaming the plugin is not a good idea because stuff will break!

Activate Bowe Codes in the “Plugins” admin panel using the “Network Activate” (or “Activate” if you are not running a network) link.

Inserting the BuddyPress Shortcodes in Post and Pages

After you’ve installed the plugin you’ll know see a cool icon in the post and page writing screen.

screenshot-3

This button allows you to easily and quickly insert your shortcodes. Every shortcode has several configuration option that allow you to customize the output easily. Isn’t that awesome? Anyways here are some of the things you can expect:

  • Avatar = Yes/No
  • Avatar Size = “60″
  • Type = “Features, Popular, New ” (Group and Member shortcodes)
  • Amount = “10″ (amount of items to show)
  • Class =”my_groups” (allows you to specify a specific CSS class to the output)

Just check out all of the options and experiment a bit.

Inserting the BuddyPress Shortcodes in Widgets and Templates

To enable the use of shortcodes in Text Widgets just add the following code to your (Child Themes) functions.php file

add_filter( 'widget_text', 'shortcode_unautop');
add_filter( 'widget_text', 'do_shortcode');

To output a shortcode in a template file just use this piece of code

<?php do_shortcode('[bc_member name="imath" size="100" fields="About me,Website,Twitter Name"]'); ?>

Feature Suggestions?

You might have some ideas to improve this plugin or have questions about the usage. Just leave your ideas and suggestions in the comments. Finally be sure to thank iMath for his great work as well. For some crazy reason he does not take donations, but donations can be made to any other awesome BuddyPress project or Charity instead!

From http://bp-tricks.com/