Compatibility with “Custom post types, Custom Fields & more” plugin
-
Hello! Would be great that this plugin is compatible with “Custom post types, Custom Fields & more”.
https://ww.wp.xz.cn/support/topic/compatibility-with-schema-structured-data-for-wp-amp-plugin/
Many thanks! ππ»
-
Hi there, Thank you for getting in touch with us. Could you please provide more details about your specific goals for the plugin? Are you encountering any issues with it?
I have a Custom Post Type on my site.
I have defined a Schema Type associated with this Custom Post Type.
In Structured Data > Schema Types > Add/Edit Schema Type > Modify Schema Output
I want to map Schema Properties to WordPress Custom Post Type values, and Custom Taxonomies.
This is possible when I use the “Advanced Custom Fields (ACF)” plugin.
But it is not possible with the “Custom post types, Custom Fields & more”.
It would be great to have the same behaviour with both plugins.
Please, do let me know if I have explained myself correctly. Many thanks. ππ»
Hi there, Thanks for reaching out to us. We have raised a GitHub ticket in our repository and this will be addressed in the upcoming update.
You can track the progress here: https://github.com/ahmedkaludi/schema-and-structured-data-for-wp/issues/2017
Thank you @magazine3 ππ»
Youβre most welcome. Feel free to reach out if you have any other concerns, weβll be happy to assist you.
Hi @magazine3 (thanks @artgoddess)
we are working on this integration, we can insert the logic in the “saswp_modify_post_meta_list” filter into our plugin, but your modification would still be necessary to recover the image-type fields (already integrated with ACF).
We will soon release version 5.x of our plugin, some methods of the code below will only be available with the new version, I advise you to wait for our update before releasing this integration:
// Add fields to dropdown add_filter( 'saswp_modify_post_meta_list', function ( $options ) { $field_groups = cpt_field_groups()->get_registered_groups(); foreach ( $field_groups as $field_group ) { $id = ! empty( $field_group['id'] ) ? $field_group['id'] : false; $label = ! empty( $field_group['label'] ) ? $field_group['label'] : CPT_NAME; $supports = ! empty( $field_group['supports'] ) && is_array( $field_group['supports'] ) ? $field_group['supports'] : false; $fields = ! empty( $field_group['fields'] ) ? $field_group['fields'] : array(); if ( ! $id || in_array( $id, array_keys( cpt_pro_ui()->post_types ), true ) ) { continue; } $meta_text = array(); $meta_image = array(); foreach ( $fields as $field_config ) { if ( 'file' == $field_config['type'] && 2 > count( $field_config['extra']['types'] ) && ( empty( $field_config['extra']['types'][0] ) || 'image' == $field_config['extra']['types'][0] ) ) { $meta_image[ $field_config['key'] ] = $field_config['label']; continue; } $meta_text[ $field_config['key'] ] = $field_config['label']; } if ( ! empty( $meta_text ) ) { $options['text'][] = array( 'label' => $label . ' [' . implode( ', ', array_map( function ( $item ) { return $item['id']; }, $supports ) ) . ']', 'meta-list' => $meta_text, ); } if ( ! empty( $meta_image ) ) { $options['image'][] = array( 'label' => $label . ' [' . implode( ', ', array_map( function ( $item ) { return $item['id']; }, $supports ) ) . ']', 'meta-list' => $meta_image, ); } } return $options; } ); // My test to override ACF function, please adapt without override if ( ! function_exists( 'get_field_object' ) ) { function get_field_object( $field ) { global $post; $field_object = cpt_fields()->get_field_object( $field, \CPT_Field_Groups::SUPPORT_TYPE_CPT, $post->post_type ); if ( 'file' == $field_object['type'] && 2 > count( $field_object['extra']['types'] ) && ( empty( $field_object['extra']['types'][0] ) || 'image' == $field_object['extra']['types'][0] ) ) { $field_object['type'] = 'image'; } return $field_object; } }@ArtGoddess: Hi, hope youβre doing well. Weβve released a new update, so kindly update the plugin with the new version 1.23 and give it a try. Please feel free to reach out to us if you have any concerns.
Great! Now both plugins are compatible, many thanks to all! ππ»
Glad to hear that the issue has been resolved. π Please reach out to us if you have any concerns. Have a great day ahead!
-
This reply was modified 2 years, 6 months ago by
Magazine3.
-
This reply was modified 2 years, 6 months ago by
The topic ‘Compatibility with “Custom post types, Custom Fields & more” plugin’ is closed to new replies.