Skip to content

Posts tagged ‘WordPress 3.0’

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: 2% [?]

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% [?]