Execute WordPress Shortcodes in Schema.org Values

Hi, I need to execute WordPress Shortcodes – see example below:

http://schema.org/Product

description value:

[kredit_at xpath="//calculator(@id='12430')/matrix(@type='Kredit')/products/product(@id='1488')/minDebitRate" round="yes"]

How can this be done?

7 thoughts on “Execute WordPress Shortcodes in Schema.org Values

    1. When will SNIP be able to execute Shortcodes? Without this function, the plugin is useless for me – since I would have to manually update EVERY single page every day…

  1. Please add this as a feature request. You can do that from your WordPress dashboard in the SNIP -> Support menu. It’s added to SNIP when it’s needed by others, too.

    You can stick with the option of creating your own field types instead (see link above).

  2. thanks for your reply. I am not a developer, that is why I can not create own field types by myself. Would you offer this paid service? Thanks in advance.

    1. Thank you very much – this solution works great so far! However, in some fields, the option “Shortcode content” is not available -> e.g. URL or IMAGE can not be output via Shortcode with current solution. Can you assist?

  3. Sure. You can do that.

    Just copy&paste line 52 to 56 in the script on the above linked page, so that the function looks like this in the end:

    
    function snip_scc_subselects( $values ) {
    
    	$values['http://schema.org/Text'][] = [
    		'id'     => 'textfield_snip_scc_shortcode',
    		'label'  => esc_html_x( 'Shortcode content', 'subselect field', 'snip-scc' ),
    		'method' => 'snip_scc_callback',
    	];
    
    	$values['http://schema.org/URL'][] = [
    		'id'     => 'textfield_snip_scc_shortcode',
    		'label'  => esc_html_x( 'Shortcode content', 'subselect field', 'snip-scc' ),
    		'method' => 'snip_scc_callback',
    	];
    
    	return $values;
    }
    

Leave a Reply Cancel reply