Voor google Rich Snippets maken moet per post type en algemeen. Onderstaand op basis van Loyal Partners. (diensten / blog berichten / boeken)

In header.php

<?php // rich snippets ?>
<?php // Algemeen ?>
<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Organization",
  "address": "<?php the_field('adres','options'); ?>",
  "email": "<?php the_field('email','options'); ?>",
  "telephone": "<?php the_field('telefoonnummer','options'); ?>",
  "member": [
    {
      "@type": "Organization"
    },
    {
      "@type": "Organization"
    }
  ],
  "alumni": [
    {
      "@type": "Person",
      "name": "Jan Frens"
    },
    {
      "@type": "Person",
      "name": "Louise Knegtel"
    }
  ],
  "name": "Loyal Partners"
}
</script>
<?php // Diensten ?>
<?php if(is_page_template('page-diensten.php') || is_singular('diensten')): ?>
<script type="application/ld+json">
{
  "@context": "http://schema.org/",
  "@type": "Service",
  "serviceType": "Diensten",
  "name": "<?php echo wp_trim_words( get_field('titel'), 150, '...' ); ?>",
  "description": "<?php echo wp_trim_words( get_the_content(), 150, '...' ); ?>",
  "provider": {
    "@type": "LocalBusiness",
    "name": "Loyal Partners",
    "image": "<?php the_field('logo','options'); ?>",
    "address": "<?php the_field('adres','options'); ?>",
    "telephone": "<?php the_field('telefoonnummer','options'); ?>"
  }
 }
</script>
<?php endif; ?>
<?php // Blog/nieuws berichten ?>
<?php if(is_single()): ?>
<script type="application/ld+json">
{
  "@context": "http://schema.org/",
  "@type": "Article",
  "name": "<?php echo wp_trim_words( get_the_title(), 150, '...' ); ?>",
  "description": "<?php echo wp_trim_words( get_the_content(), 150, '...' ); ?>",
  "datePublished":"<?php echo get_the_date('c'); ?>",
  "headline":"<?php echo wp_trim_words( get_field('titel'), 150, '...' ); ?>",
  "image":"<?php echo get_the_post_thumbnail_url(); ?>",
  "publisher": {
	  "@type": "Organization",
	  "name": "Loyal Partners",
	  "logo": "<?php the_field('logo','options'); ?>"
  },
  "author":"Jan Frens"
}
</script>
<?php endif; ?>
<?php // Boeken ?>
<?php if(is_singular('boeken')):
	$contentboek = get_field('kolom_1_boek') . get_field('kolom_2_boek');
?>
<script type="application/ld+json">
{
  "@context":  "http://schema.org/",
  "@type": "Book",
  "additionalType": "Product",
  "name": "<?php echo wp_trim_words( get_the_title(), 150, '...' ); ?>",
  "about": "<?php echo wp_trim_words( $contentboek, 250, '...' ); ?>",
  "image": "<?php the_field('logo','options'); ?>",
  "author": "Jan Frens"
}
</script>
<?php endif; ?>

 

Geef een reactie 0