How to remove/alter schema.org micro data?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #7187 Reply

    SyedTech

    Hi,
    I am designing a website using Frontier theme on localhost. I have almost manage to do all what I need. It is a great theme. SEO will play a major role in this website in future.
    I have noticed while testing site html markup on google structured data testing tool that there are some errors if I remove Author, Date Published, etc from post using theme option panel. I don’t want these micro formats on my post page to be present. I have found that if I remove filter frontier_schema I can remove all micro formats but I am unable to remove this filter using command remove_filter(‘frontier_schema’, ‘frontier_get_schema’) in my custom.php file included in last line of the theme functions.php.
    It will be very nice if I may able to remove only some micro formats those have invalid/incomplete data.

    Regards

    #7188 Reply

    Ron
    Keymaster

    To remove all schema.org markup use this:

    add_filter( 'frontier_schema', '__return_empty_string' );
    

    To customize what markup will be used try something like this:

    add_filter( 'frontier_schema', 'new_markup' );
    
    function new_markup() {
    	return 'Test';
    }

    This is just a sample. You can copy and modify the code inside frontier_get_schema() to use as your new_markup() function.

    #7189 Reply

    SyedTech

    Hi,

    Thank you very much. Works great.

    I have removed schema.org micro data using add_filter( ‘frontier_schema’, ‘__return_empty_string’ ) and worded as expected. Then added a filter add_filter( ‘frontier_schema’, ‘st_frontier_get_schema’ ) for custom micro data by adding a function in my custom.php file. This function
    function st_frontier_get_schema( $name ){
    // some code here
    }
    is called properly but $name parameter does not work so I am unable to track micro data entities.

    Best regards

    #7190 Reply

    Ron
    Keymaster

    On the parent theme’s function.php, change the original frontier_schema() function to this (I’ll be adding this change on the next theme update):

    function frontier_schema( $name ) {
    	$value = frontier_get_schema( $name );
    	echo apply_filters( 'frontier_schema', $value, $name );
    }

    Then on your custom php file use something like this:

    add_filter( 'frontier_schema', 'st_frontier_get_schema', 10, 2 );
    
    function st_frontier_get_schema( $value, $name ) {
      // some code here
    }
Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: How to remove/alter schema.org micro data?
Your information: