Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1348516

    Hi,
    I need to completely remove any reference to itemprop datePublished and dateModified from the theme.
    I’ve tried with this code:

    function avia_markup_helper_attributes_modified($attributes, $args) {
        if (check_active_remove_frontend_date()) {
            if ($args['context'] == 'entry_time') {
                unset($attributes['itemprop']);
                unset($attributes['datetime']);
            } 
            
            if($args['context'] == 'blog_date_modified') {
                unset($attributes['itemprop']);
                unset($attributes['itemtype']);    
            }
        }
        return $attributes;
    }
    
    add_filter('avf_markup_helper_attributes', 'avia_markup_helper_attributes_modified', 10, 2);

    It partially works, and now in page html code I have this for datePublished and dateModified :

    <span class="av-structured-data">2022-04-01 17:17:13</span>
    <span class="av-structured-data">2022-04-14 09:55:33</span>

    Is there a way to completely remove these span? I don’t want any date reference in the theme.

    Thank you.

    #1348577

    Hey WPStyling2020,
    Please try editing the schema code in /enfold/includes/helper-markup.php by removing lines 425-433, in version 4.9.2.1:

    		if( ! in_array( 'date', $exclude ) )
    		{
    			$output .= "<span class='av-structured-data' {$entry_time_markup}>{$post->post_date}</span>";
    		}
    
    		if( ! in_array( 'date_modified', $exclude ) )
    		{
    			$output .= "<span class='av-structured-data' {$date_markup}>{$post->post_modified}</span>";
    		}

    2022-04-16_002.jpg
    then add this file to your child theme in the directory /includes/
    2022-04-16_003.jpg
    then add this function to the top of your child theme functions.php: require_once( 'includes/helper-markup.php' );
    in my test this worked:
    2022-04-16_144945.jpg

    Best regards,
    Mike

    #1348810

    Thank you, it works.
    Is there a way to directly modify helper-markup output trough a specific hook ( to avoid helper-markup.php copy in child theme folder) ?

    #1348927

    Hi,
    Glad to hear that this solution works for you, I will ask the rest of the team if they know of a filter solution, thank you for your patience.

    Best regards,
    Mike

    #1348934

    Hi,
    The Dev Team will add a filter to the next release, you can apply this now to your version by first removing the child theme file above and the function for it in the child theme functions.php and adding this line to parent theme /enfold/includes/helper-markup.php
    on line 348 $exclude = apply_filters( 'avf_blog_entry_markup_helper_exclude', $exclude, $id );
    and then add this filter to your child theme:

    function custom_avf_blog_entry_markup_helper_exclude( array $exclude = array(), $id = 0 ) {
    	$exclude = array_merge( $exclude, array( 'date', 'date_modified' ) );
    	return $exclude;
    }
    add_filter( 'avf_blog_entry_markup_helper_exclude', 'custom_avf_blog_entry_markup_helper_exclude', 10, 2 );

    Best regards,
    Mike

    #1349156

    Great!
    Thank you for your support.
    Looking forward for the next theme release.

    • This reply was modified 2 years, 6 months ago by WPStyling2020.
    #1349158

    Hi,
    Glad we were able to help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.

    Best regards,
    Mike

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘How to remove span.av-structured-data for specific itemprop’ is closed to new replies.