WordPress.org

Ready to get started?Download WordPress

Forums

My Content Management
Repeatable Custom Field Only Showing First Entry (3 posts)

  1. DevonHarper
    Member
    Posted 7 months ago #

    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?

    http://wordpress.org/plugins/my-content-management/

  2. DevonHarper
    Member
    Posted 7 months ago #

    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.

  3. Joe Dolson
    Member
    Plugin Author

    Posted 7 months ago #

    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...

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.