Community Forums › Forums › Archived Forums › General Discussion › Best approach to implement Schema.org markup!
Tagged: schema markup
- This topic has 17 replies, 6 voices, and was last updated 7 years, 4 months ago by vouchermedia.
-
AuthorPosts
-
December 4, 2016 at 9:16 am #196980rocketeerMember
Hi,
What's the best approach in implementing Schema.org markup?
It says that the framework has this feature built-in. But where
do you paste in the code if you want to override default settings?I saw an old plugin that hasn't been updated in 2 years:
https://wordpress.org/plugins/microdata-manager/Thanks!
December 4, 2016 at 9:35 am #196984Brad DaltonParticipantYou can use that plugin or a filter function for each to modify the default which you'll find in genesis > lib > functions > markup.php starting on line 225.
December 4, 2016 at 10:00 am #196989rocketeerMemberThanks! I tried the plugin and it's not well built out. I think a more manual approach is better.
When I edit a page there is a meta box called Scripts.
How would I create a similar meta box that I would call Microdata for pages and posts? And somehow direct where the code shall be pasted, for example after the <head> tag. Will this code conflict with the built in Schema markup?
Thanks!
December 4, 2016 at 11:06 am #196990Brad DaltonParticipantDecember 4, 2016 at 11:47 am #196991rocketeerMemberI want to do both. The markup in the plugin was very sparse and did not address the snippets found by the structured data tool.
When I run one of my inner pages to the structured data tool, I find four snippets:
WebPage
WPHeader
CreativeWork
SiteNavigationElementWhen I run my front page on the AltitudePro theme, I find:
WebPage
Organization
WPHeader
CreativeWork
SiteNavigationElementSo I'd like to both enhance/add more info to the snippets already added by Genesis following the information here:
http://schema.org/docs/full.htmlAnd also add new snippets. Like LocalBusiness and Organization to the inner page. I'm not sure how to do this properly.
December 4, 2016 at 11:54 am #196993Brad DaltonParticipantDecember 4, 2016 at 4:04 pm #197015rocketeerMemberI think I'm after what they discuss at 25:15 here: https://www.youtube.com/watch?v=WlmNjdZ5EGU
As usual, the Genesis Framework becomes very technical for non-programmers like me.
Thanks anyways for your suggestion, which seems to be in line with what the developers discuss in the video above.
December 4, 2016 at 4:44 pm #197019Brad DaltonParticipantDecember 4, 2016 at 6:55 pm #197024jdenningParticipantI have added address schema by hand only to have them removed by the text editor when I switch between the visual and text tabs. If I reload after each tab switch I am OK but if I forget, the address schema is gone for good. My work around is to keep a copy in a local text editor just in case.
December 5, 2016 at 10:52 am #197062rocketeerMemberIf Studiopress created a plugin as discussed in the video it would give the Genesis framework an upper hand compared to competing frameworks.
December 5, 2016 at 10:58 am #197064Brad DaltonParticipantHow would I create a similar meta box that I would call Microdata for pages and posts? And somehow direct where the code shall be pasted, for example after the <head>
You can add the meta box no problem however it would need to output in a specific hook location which could be after the head tag or anywhere else. You could have multiple meta boxes which output in different positions in the page's source code.
December 5, 2016 at 11:10 am #197065rocketeerMemberMaybe this plugin would work: https://wordpress.org/plugins/meta-box/
December 5, 2016 at 11:21 am #197067Brad DaltonParticipantFor the input yes. Then you need to output in multiple positions. This can be done using custom fields with genesis hooks.
December 5, 2016 at 12:17 pm #197074Victor FontModeratorLearn how the genesis_attr and genesis_markup functions work. For every element touched by the genesis framework, there are two filters created that allow you to manipulate the content. For example, when the HTML body element is created, you have filters created called genesis_attr_body and genesis_attr_body_output. The first can be used to change the parameters, such as itemscope and itemtype. The second holds the entire HTML output for the body tag. You can change anything you want within it. You don't need a plugin to do this stuff, you just need to learn how these two very powerful functions and WordPress apply_filters work. This is a great place to start: https://knowthecode.io/labs/developers-guide-customizing-genesis-markup
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?December 10, 2016 at 11:13 pm #197418paulangMemberHey guys, don't bother clicking around these above links. I'm ashamed i wasted so much time googling.
But this nice dude here has done the work for us. Apparently quite easy as long we have done our due diligence in understanding genesis.
https://www.rfmeier.net/custom-microdata-with-genesis-2-0/
His code definitely works:
<?php //* do not include php tag add_filter( 'genesis_attr_body', 'about_page_body_schema' ); /** * Callback for Genesis 'genesis_attr_body' filter. * * Use the AboutPage microdata schema for the About page. * * @package Genesis * @category Attributes * @author Ryan Meier http://www.rfmeier.net/ * * @param array $attributes The array of attributes * @return array $attributes The array of attributes */ function about_page_body_schema( $attributes ) { // if About page, use the AboutPage schema if ( is_page( 'about' ) ) { $attributes['itemtype'] = 'http://schema.org/AboutPage'; } // if Services page, use the ContactPage schema if ( is_page( 'services' ) ) { $attributes['itemtype'] = 'http://schema.org/ContactPage'; } return $attributes; }
i've modified the is_page parameters to fit either the post id or the post title (google that). Pretty easy.
Works on my site here: punggolgp.com/contact/
Now the next step is to add the child elements: itemscope and itemprop .
Does anyone know if these can be keyed in directly in the body of the wordpress editor?
Thanks guys!
December 11, 2016 at 12:42 am #197419paulangMemberI figured out the problem, it is the wordpress editor that is removing the span tags as it doesnt recognise it to be useful.
So i used an easy way out, someone's plugin: "Protect schema.org markup in HTML editor"
So i managed to get the page working for now... I'm just going to leave it alone for now. I am happy enough getting my localBusiness schema up
https://www.punggolgp.com/contact/
But it somehow breaks images!!!
So anyway, you have to copy and paste your images urls directly into the code to get it working...
Not perfect, but can someone smart please save us please hahahha...
December 11, 2016 at 2:09 pm #197426Brad DaltonParticipantDecember 12, 2016 at 1:32 am #197448vouchermediaMemberThanks for giving such an informative post.I have a website based on voucher codes .This article help me to solve some technical issues in my website.Thanks for the great job.
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.