Tagged: Codeblock, google snippet
Hi There,
just got this problem, when I use the Codeblock:
See Screenshot here.
Is there a recommendation on how I can best fit this?
Thanks in advance
KiM :)
Hey KiM,
I’m not sure I understand that problem, could you try to explain a bit further please? Note that we don’t have any native German speakers on the moderator team.
Best regards,
Rikard
The yellow section is the Google Snippet for stars in google Search and it is also visible on my site. The red section is made by enfold. The itemscope and the itemtype-Attributs in the red section are interrupting the Snippet and the rel-attribute is wrong with the a element…. this is automatic by enfold.
Is there a possibility to put the snippet on my site without code changes or some code around it?
Thanks in advance!
Best KiM :)
Hi,
Sorry for the late reply and thanks for the screenshot, instead of using a Text element to display your code snippet you should try using a Code Block element.
To remove the “itemscope” & “itemtype” from the code block parent add a custom ID to the code block element, such as “remove_parent_attr”
Then add this code to the end of your functions.php file in Appearance > Editor:
function remove_parent_attr(){
?>
<script>
(function($){
$(window).load(function(){
$( '#remove_parent_attr' ).each(function() {
$(this).removeAttr('itemscope');
$(this).removeAttr('itemtype');
$(this).find('.avia_codeblock').removeAttr('itemprop');
});
});
})(jQuery);
</script>
<?php
}
add_action('wp_footer', 'remove_parent_attr');
Then clear your browser cache and check.
Best regards,
Mike
Thank you. I will try this! :)
Best regards
KiM