Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Magazine3

    (@magazine3)

    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?

    Thread Starter ArtGoddess

    (@artgoddess)

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

    Plugin Author Magazine3

    (@magazine3)

    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

    Thread Starter ArtGoddess

    (@artgoddess)

    Thank you @magazine3 ????

    Plugin Author Magazine3

    (@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;
    	}
    }
    Plugin Author Magazine3

    (@magazine3)

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

    Thread Starter ArtGoddess

    (@artgoddess)

    Great! Now both plugins are compatible, many thanks to all! ????

    Plugin Author Magazine3

    (@magazine3)

    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 1 year ago by Magazine3.
Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Compatibility with “Custom post types, Custom Fields & more” plugin’ is closed to new replies.