• I have v1.8.6 of Custom Field Template installed and everything thus far has been going very smoothly with it. I’ve got a number of custom post types where I need to display select boxes or checkboxes of entries in a different post type (example: what employees worked on a project).

    The following code works great for select boxes:
    Template Content
    [Project Team Members]
    type = select
    code = 2

    PHP Code

    //Template #0 - Project - Display Resources in a selectbox
    
    $resources = new WP_Query('post_type=resources&post_status=publish&posts_per_page=-1' );
    
    $resourceNames = array();
    
    if($resources->have_posts()) : while($resources->have_posts()) : $resources->the_post();
    
    	$resourceNames[] = get_the_title();
    
    endwhile; endif;
    
    $values = $resourceNames;

    When I change the field type from select to checkbox the entire contents of my template disappear in the editing window. Doing a basic array in the same PHP box
    $values = array('cat','dog','bat');
    does work. All the documentation for select and checkbox appear to say the exact same syntax is required.

    HALP???

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter idealien

    (@idealien)

    Other things I’ve tried in debugging that were unsuccessful:

    • Set it up as sole entry on a new post type with only that field
    • Forced output to screen: echo "Title: " . get_the_title(); which does display values so I know the loop is executing but the larger form does not display. The div with id=cft which is where the full form usually is inset is empty.
    Thread Starter idealien

    (@idealien)

    This thread about Dynamic select list had a solution which worked. Not sure why loop doesn’t but it’s easy enough to make the switch for anyone who also encounters the same issue.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘checkbox array of custom post types breaks display of CFT panel’ is closed to new replies.