Skip to content

Posts by Crimson Binome

27
May

Custom Post Type Panels

Using the custom post type you will notice the page where you edit or add a new post only has the bare minimum of panels.  But what happens if I want to add a specific excerpt???

Easy :-) use the following code and add it to your functions file.

add_post_type_support( '[your custom post type name', 'excerpt' );

Im not quite sure what the other panels are called. When I find out I will reply to this post with a list.

Popularity: 1% [?]

21
May

WordPress 3.0 Custom Post Type Custom Fields

I have been trying out the custom post types for WordPress 3.0 Beta 2, I ran into a problem where i could not call the custom fields for posts i have assigned custom post type values.

I came up with this workaround for now until it is sorted.

function get_post_meta_custom($key, $single = false) {
 global $wpdb,$post;
 $answer = $wpdb->get_var($wpdb->prepare("SELECT meta_value FROM $wpdb->postmeta WHERE post_id = ".$post->ID." AND meta_key = '".$key."'"));
 return $answer;
}

Call it using the following. I use this inside on the single post inside the loop.

 if ( get_post_meta_custom('client_name', true) ) {echo get_post_meta_portfolio('client_name', true);    }

Popularity: 1% [?]

7
May

Integrate a blank BuddyBar into bbPress

First add this line of code to your bb-config.php

require_once(dirname(__FILE__) . '/../wp-load.php'); (PS my forums is set up in a forums directory in the root of my site.
You may need to change the path to your wp-load.php file)

Next create a functions.php file for your theme if not already there. Then add this line of code to the functions.php file.

add_action( 'bb_foot', 'bp_core_admin_bar');

Now create your menus and add them to the bar.

PS because the buddypress plugin is not activated on a forum, it will load the buddybar with nothing in it. If you are going to copy the default buddypress functions then make sure to change the function name or you will get and error.

Alternatively you could try include the bp-core-adminbar.php file inside buddypress/bp-core if you do not want a blank bar.

Popularity: 1% [?]

30
Apr

FeedMyMedia WPMU Recent Posts

Recent posts are great, but on a WPMU install you sometimes want to pull through blog posts from a specific sub-blog. Attached to this post is just that. A widget that will allow you to set what blog you want to pull from based on its id, how many posts you want to pull, and lastly set a title.

This is just a skeleton, you can always add in calls to custom fields and other amazing goodies.

NB Not for commercial USE

Download: fmm-wpmu-recent-posts (rename to .php)

Download: fmm-wpmu-recent-posts v1.1 (rename to .php)

Popularity: 2% [?]

3
Mar

Disable your BuddyBar

Somtimes you do not want the buddybar to display on your site. You can hide it with css but WordPress will still process all the info for it.

Add the following line to your functions.php file to disable the BuddyBar

define ('BP_DISABLE_ADMIN_BAR', false);

Popularity: 2% [?]

19
Feb

Change Xprofile Data

Update your Profile Field information for BuddyPress

xprofile_set_field_data( $field_name', $usert_id, $value);

This will not work for check boxes. Below is code that should help, check boxes need to be serialized data.

$value = maybe_serialize( [An Array of your values] );

 xprofile_set_field_data( $field_name, $user_set_id, $value);

Popularity: 2% [?]

18
Feb

WordPress Activation Key

This is how WordPress uses the new user ID and an MD5 hash to generate the activation key

$newuser_key = substr( md5( $user_id ), 0, 5 );

Popularity: 1% [?]

17
Feb

Define you BuddyPress Slugs

Add these lines of code to your wp-config.php file to rename the slugs of the buddypress components ( these are for the members slug and the groups slug )

define( 'BP_GROUPS_SLUG', 'companies' );
define( 'BP_MEMBERS_SLUG', 'volunteers' );

Popularity: 2% [?]

19
Jan

WordPress/BuddyPress – Meta title tag not working

If your buddypress child theme or customized parent theme does not work properly, in otherwords does you title tag output “[Blogname] – Blog” then use the code below to remedy the error.

Whats happening is if you use bp_title_tag() is will output the default string as seen above. If you lean towards using the WordPress conditional tags to test the pages, WordPress will see the BuddyPress pages as normal static pages.

Using bp_get_title_tag we can test to see if its a WordPress page or a BuddyPress page and use the appropriate title tag.

<title><?php
if ( is_home() ) { bloginfo('name'); echo '&nbsp;|&nbsp;'; bloginfo('description'); }
elseif ( is_search() ) { bloginfo('name'); echo '&nbsp;|&nbsp;'; _e('Search Results'); }
elseif ( is_author() ) { bloginfo('name'); echo '&nbsp;|&nbsp;'; _e('Author Archives'); }
elseif ( is_single() ) { bloginfo('name'); echo '&nbsp;|&nbsp;'; wp_title(''); } 

// Entering the buddypress tags
elseif ( is_page() ) { 

 $page_title = rtrim(ltrim(bp_get_page_title()));

 if ( $page_title == "[INSETRT YOUR WP_TITLE HERE] &#8212; Blog" ) { bloginfo('name'); echo '&nbsp;|&nbsp;'; wp_title('');}
 else{ bp_page_title(); }
}
elseif ( is_category() ) { bloginfo('name'); echo '&nbsp;|&nbsp;'; _e('Archive'); echo '&nbsp;|&nbsp;'; single_cat_title(); }
elseif ( is_month() ) {  bloginfo('name'); echo '&nbsp;|&nbsp;'; _e('Archive'); echo '&nbsp;|&nbsp;'; the_time('F'); }
elseif (function_exists('is_tag')) { if ( is_tag() ) { bloginfo('name'); echo '&nbsp;|&nbsp;'; _e('Tag Archive'); echo '&nbsp;|&nbsp;';  single_tag_title("", true); } }
else {  } ?></title>

Popularity: 10% [?]