Community Forums › Forums › Archived Forums › Design Tips and Tricks › Snippets – product archives (woocommerce) & json schema.org local business
Tagged: local business schema, Meta Description, product archive, seo
- This topic has 2 replies, 3 voices, and was last updated 6 years, 11 months ago by nobs.
-
AuthorPosts
-
April 20, 2017 at 3:06 am #205047frenchieMember
I am kind of proud about my last 2 sites - highly optimized for SEO without using a huge and lumbering SEO plugin. I hope these code snippets help someone else.
https://www.ecole-ski-evasion.com and its French version. All interconnected using hreflang attributes and the SEO is all built in without using an inefficient SEO plugin.
The bits to remember if you don't want to use Yoast for example is this type of thing in your functions.php file.
1. The product archive for a woocommerce shop needs a meta description. This seems to work nicely for me:
add_action('genesis_meta', 'custom_seo_description');
function custom_seo_description() {
if ( is_shop() ) {
echo '<meta name="description" content="For children and adults, our school offers a range skiing lessons in the French Alps at Serre Chevaliers." />';
}
}2. A title for product archive for a woocommerce shop - here we go
add_filter( 'wp_title', 'my_title_function', 10, 3 );
function my_title_function( $title) {
if ( is_shop() )
return 'Ski & snowboard lessons';
else
return $title;
}And finally but not least. Your local business json being loaded onto the home page only. Just my example.
/* Json payload for local SEO */
add_action( 'wp_head', 'child_payload', 5 );
function child_payload() {
if ( is_front_page() ) { ?>
<script type="application/ld+json"> {
"@context" : "http://schema.org",
"@type" : "localBusiness",
"address" : {
"@type": "PostalAddress",
"addressLocality": "Saint-Chaffrey",
"addressCountry": "France",
"postalCode": "05330",
"streetAddress": "Centre commercial Le Serre d'Aigle, Place du Téléphérique" },
"name":"ESI Ecole de Ski Evasion",
"email":"[email protected]",
"hasMap":"https://www.google.com/maps/place/ESI+Ecole+de+ski+Evasion/@44.9333613,6.5869877,15z/data=!4m5!3m4!1s0x0:0xcedd352ab6a10f11!8m2!3d44.9333613!4d6.5869877",
"telephone":"+33 4 92 24 02 41",
"openingHours": [
"Mo,Tu,We,Th,Fr,Sa,Su, 08:45-12:00, 14:00-18:00" ],
"Image": "https://www.ecole-ski-evasion.com/wp-content/uploads/2017/04/ski-school.jpg",
"logo" : "https://www.ecole-ski-evasion.com/wp-content/uploads/2017/04/ecole-ski-logo.png",
"url":"https://www.ecole-ski-evasion.com",
"sameAs" : [ "https://www.ecole-ski-evasion.fr", "https://www.facebook.com/EcoleDeSkiEvasion", "https://plus.google.com/113181281635819810244/, https://www.youtube.com/channel/UCSFIqTft-rpUu9r5RkUzx_g"]
}
</script>
<?php }}Using this code and your normal Genesis SEO settings, a large SEO plugin becomes pointless for me at least.
April 25, 2017 at 7:51 am #205266Victor FontModeratorSEO is a lot more complex than just using the code you suggest. Thanks for posting and glad it works for your needs.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?May 4, 2017 at 2:52 am #205862nobsMemberThanks so much Frenchie - that is very helpful & exactly what I needed! Much appreciated.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.