Support » Plugin: Custom Content Type Manager » [Plugin: Custom Content Type Manager] get_post_complete ins't getting the complete post

  • I’m having trouble getting get_post_complete to work.

    For test purposes, I’ve stripped everything out of my template file except the following code:

    $epo_results = get_posts(array('post_type'=>'epo-event'));
     foreach($epo_results as $r) {
       echo "Before get post complete" ;
       $r = get_post_complete($r->ID);
       echo "After get post complete" ;

    It never reaches the second echo. I do see the first echo, and a dump of information for one custom post type, but the data does not include custom fields, just standard WP post fields.

    If it matters, this is a genesis framework site.

    Any thoughts?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor fireproofsocks


    Which version are you using? I believe there was a fix for that function in the latest release ( was released today).

    But I think I screwed up the SVN repo so the version number is off. I hate the WP repo… sigh.

    Check your custom-content-type-manager/includes/functions.php file and verify that the function looks like this:

    function get_post_complete($id) {
    	$complete_post = get_post($id, ARRAY_A);
    	if ( empty($complete_post) ) {
    		return array();
    	$custom_fields = get_post_custom($id);
    	if (empty($custom_fields)) {
    		return $complete_post;
    	foreach ( $custom_fields as $fieldname => $value ) {
    		if ( count($value) == 1 ) {
    			$complete_post[$fieldname] = $value[0];
    		else {
    			$complete_post[$fieldname] = $value[0];
    	return $complete_post;

    Thanks, Everett. That’s where the problem lies.

    My function shows:


    I’ve removed that line of code and it is working now.

    I’ll update to the most current CCTM version ASAP.

    Thanks for your help.


    I just installed the most recent version. However, I’m still seeing some weirdness.

    If I:

    print $epo_slider;
    print $r->post_title;

    I get a blank in both cases. If I:

    print $r[epo_slider];
    print $r[post_title];

    I get the results as expected (992 and “Viva Violin” … epo_slider is an image).



    after get_post_complete works as expected. I get a listing of the complete array.

    I can obviously work around this, but I was thinking this might be meaningful for you.

    Oh, and if I:

    $epo_results = get_posts(array('post_type'=>'epo-event'));
    foreach($epo_results as $r)
    {print $r->ID;


    $r = get_post_complete($r->ID);

    it displays the ID, as expected (995 in this case).

    Plugin Contributor fireproofsocks


    Thanks Mike — some of this is due to the fact that WP allows for both arrays OR objects to be returned, so you could get a result that you have to access via something like $post->attribute (object) or $post[‘attribute’] (array) — it depends on how you call it. I’ve opted to use arrays for my functions… it got to be too tedious to support both objects and arrays, so I just went for one (arrays). Always quote your array keys, by the way: $array['key'] is good, $array[naked] is not.

    Make sure you turn WP debug mode in your config file:

    define('WP_DEBUG', true);

    I bet the “blank” screen really is an error message that would probably be quite useful to you. I’m not sure how you’re getting your variable there, so I’m not sure how to comment, but I bet if you turn on debugging you’ll track it down pretty quickly.

    Hope that helps.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Custom Content Type Manager] get_post_complete ins't getting the complete post’ is closed to new replies.