• Resolved DevonHarper

    (@devonharper)


    I have successfully created a custom post type with this plugin, and have added several custom fields to it. I have a template that is working well for all of the custom fields, except the one field that I have marked as repeatable.

    This repeatable field {_booth} appears to be working when adding/editing the custom posts. I can add and delete multiple booths to any custom post. But when the custom posts are displayed on the front end, the template is only displaying the first entry in {_booth}.

    I am using the list view if that makes any difference.

    Are there any special attributes or arguements I need to apply to the shortcode or template in order to make a repeatable field display all of the entries?

    https://www.ads-software.com/plugins/my-content-management/

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

    (@devonharper)

    I am using My Content Management ver 1.4.2

    I think I have found the issue in mcm-view-custom-posts.php on lines 160-164:

    if ( is_array( $value[0] ) ) {
    	foreach( $value[0] as $val ) {
    		$cfield[] = ( $is_email )?apply_filters('mcm_munge',$val,$val, $custom ):$val;
    	}
    	$p[$key] = explode( ", ", $cfield );

    I’m not sure if $value[0] is ever an array. In my instance it is always a string, and I end up with $value[0], $value[1], etc. I have hacked my copy of mcm-view-custom-posts.php to change lines 160-164 to:

    if ( count( $value ) > 1 ) {
    	$cfield = array();
    	foreach( $value as $val ) {
    		$cfield[] = ( $is_email )?apply_filters('mcm_munge',$val,$val, $custom ):$val;
    	}

    And my shortcode and template now seem to be working, but I am not sure if there are any other effects of this code change.

    Plugin Author Joe Dolson

    (@joedolson)

    I’ll check this out – I know there have seemed to be some various inconsistencies in the depth of arrays, so I’ll try and work that out more reliably…

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Repeatable Custom Field Only Showing First Entry’ is closed to new replies.