Tagged: 

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #938709

    Hi Guys,

    You have really given us a beautiful and extremely powerful theme, and all the filters and hooks you’re making available to us is greatly appreciated.

    Right now, I’m trying to tweak the Schema.org markup to fix a few errors Google is reporting, and to better suit the particular website I’m working on, and having studied your code in helper_markup.php, I can appreciate how difficult it must be to implement Schema across such a complicated and diverse theme like Enfold.

    So far, I’ve taken care of the Google errors caused by the ImageObject issue and I’ve also successfully managed to overwrite the attribute for a specific context (job) globally in my child theme functions.php.

    Now I’m trying to customize the markup of specific instances of ATB shortcode elements, but I can’t seem to get this working. I’ve added the following code to my functions file in my child theme:

    /* Schema.org Markup - Add override to shortcodes */
    /*
    Add new input option field to the shortcode option windows. Also include sub-element option windows in case a custom markup is required for image slides, content slides, etc.
    */
    
    add_filter('avf_template_builder_shortcode_elements','avia_custom_markup_element', 10, 2);
    function avia_custom_markup_element($elements, $config)
    {
    	$elements[] = array(
    		"name" => __("Custom Schema.org Markup Context",'avia_framework' ),
    		"desc" => __("Set a custom schema.org markup context",'avia_framework' ),
    		"id" => "custom_markup",
    		"type" => "input",
    		"std" => "");
    
    	foreach($elements as $key => $data)
    	{
    		if(!empty($data['subelements']))
    		{
    			$elements[$key]['subelements'][] = array(
    			"name" => __("Custom Schema.org Markup Context",'avia_framework' ),
    			"desc" => __("Set a custom schema.org markup context",'avia_framework' ),
    			"id" => "custom_markup",
    			"type" => "input",
    			"std" => "");
    		}
    	}
    
    	return $elements;
    }
    
    /*
    Check if the custom_markup option is set. If yes store it into the §meta variable to pass it to the shortcode handler
    */
    add_filter('avf_template_builder_shortcode_meta', 'add_markup_to_meta', 10, 4);
    function add_markup_to_meta($meta, $atts, $content, $shortcodename)
    {
    	$meta['custom_markup'] = isset($atts['custom_markup']) ? $atts['custom_markup'] : '';
    	return $meta;
    }
    
    /*
    Check if the custom_markup option is set. If yes store it into the §meta variable to pass it to the shortcode handler
    */
    add_filter('avf_markup_helper_args','print_args_schema_org', 10, 1);
    function print_args_schema_org($args)
    {
    	if(!empty($args['custom_markup']))
    	{
    		$args['context'] = $args['custom_markup'];
    	}
    
    	if($args['context'] == "no_markup") $args['context'] = false;
    
    	return $args;
    }

    The “Custom Schema.org Markup Context” field is showing for each short code element screen, however I’m not sure what to put in there exactly. I’ve tried Adding “CreativeWork” to this field in the 3/4 flex column that contains a video element, and to the actual tab of the tabbed slider element that contains an instance of your Video shortcode, to try and get the VideoObject markup working on the last tab on this page:

    (See Kenya Page link in Private field)

    However, the CreativeWork markup doesn’t show up, and Google’s Structured Data Testing Tool doesn’t pick up any of the video markup. See structure data results in private section.

    I also tried adding “no_markup” to the Blog Posts Element at the end of the home page (see homepage link in private section) to try and remove all markup on the blog post listings on the homepage, but that doesn’t work either.

    Am I misunderstanding your instructions for the implementation of the custom markup field on this page: https://kriesi.at/documentation/enfold/customize-schema-org-markup/, or am I using it incorrectly?

    It would also be really great if we could somehow markup our About Us and Contact Us pages with the more specific implementation of WebPage schema: http://schema.org/AboutPage

    Any assistance with this would be greatly appreciated.

    Thank you.

    Brendon

    #939596

    Hey inMotionGraphics,

    Thank you for using Enfold.

    The modification above will allow you to change the default markup of a specific element in the builder. For example, a video element’s default markup can be set to “header”, “image” or any markup context as long as it is available in the includes > helper-markup.php file. If the custom markup field is set “no_markup”, it will disable the default schema markup for that particular element. Please note that the theme has the very basic schema markup and this modification allows you extend that.

    Best regards,
    Ismael

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.