Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics
Marcel

Relational Field – Add more than one

Hi,

in the settings it says that I can add more than one relational field if I separate them with commas:
“Multiple ids should be separated by a comma.”

For my field I choose: field type “Relational”, “post” (sorry, hope it is “post”. I use the german version), field “ID”.
When editing I can only choose one post or product. If I use “multiple” instead of relational, I can just sort.

Would be great if multiple relational fields could be supported. Thanks for that great plugin!

6 years, 11 months ago
Stefan van den Dungen Gronovius
Developer

Hi Marcel,

Thanks for your feedback. I think the most common use for the relational post type for the custom field column is to display a single field. Although the display also works with comma separated values, editing is a different story. When you have more complex fields like this, I think it’s better to use a plugin to handle custom fields like ACF, Pods or Types. All these plugins have great features to make relations between different post types.

And in combination with one of our integration add-ons for these plugins, you can easily create a column for those fields including inline edit, sorting and filtering support completely written for the selected fields.

6 years, 11 months ago
Marcel

Hi Stefan,

thanks for your reply.

I am using ACF. It’s a “lite” version of ACF that is delivered within my theme. They are using the relational fields for outputting similar posts. So, adding more than one post or product is in most cases necessary :-)

As of now the ACF add-on from Codepress does not seem to support more than one field (during inline editing). At least I am not able to select more than one. Maybe I am doing something wrong…

6 years, 11 months ago
Stefan van den Dungen Gronovius
Developer

Hi Marcel,

I’m a little bit confused. It seems that you have the ACF integration add-on installed but based on your first message you use the custom field column. When you have the ACF integration installed, you should have an Advanced Custom Field column available besides the Custom Field column. If you use this column and you select the correct Relation field, it should allow you add multiple posts when using inline edit. http://recordit.co/2ymD4ZJ90u

6 years, 11 months ago
Marcel

Hi Stefan,

sorry for the confusion.

You are totally right. With ACF it works. I need to edit a custom field (not ACF as wrongly mentioned by me).

Admin Columns shows the message “Uses the id from a Beitragstyp to display information about it. Multiple ids should be separated by a comma.” in Custom Fields as well.

So, this is wrong? Because that does not seem to work.

6 years, 11 months ago
Stefan van den Dungen Gronovius
Developer

Hi Marcel,

Thanks, I understand the issue now. You’re correct that the display can work with single ID’s, multiple ID’s, multiple custom fields in the database. But for inline edit we have to choose which of these three supported values we use for the inline edit feature. Storing a single value (ID) is the most used and best way to support it easier to do something with one ID on the front-end than to do something with a comma separated value.

You can change the edit settings for a specific column by using the ‘acp/editing/view_settings’ filter. You can use the snipped below to enable multiple fields for the custom field with type set to ‘Posts’.

/**
 * @param array $data
 * @param AC_Column $column
 *
 * @return mixed
 */
function my_acp_cf_posts_editing_settings( $data, $column ) {

	if ( $column instanceof AC_Column_CustomField ) {
		if ( 'title_by_id' === $column->get_field_type() ) {
			$data['multiple'] = true;
		}
	}

	return $data;
}

add_filter( 'acp/editing/view_settings', 'my_acp_cf_posts_editing_settings', 10, 2 );
6 years, 11 months ago
Marcel

Hi Stefan,

this is exactly what I was searching for. Thank you so much! I give you guys a good review!!

Regards

6 years, 11 months ago
Stefan van den Dungen Gronovius
Developer

You’re welcome.
Great this works for you. I will close this ticket.

6 years, 11 months ago

You must be logged in to reply to this topic.