• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Best approach to implement Schema.org markup!

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Best approach to implement Schema.org markup!

This topic is: not resolved

Tagged: schema markup

  • This topic has 17 replies, 6 voices, and was last updated 8 years, 11 months ago by vouchermedia.
Viewing 18 posts - 1 through 18 (of 18 total)
  • Author
    Posts
  • December 4, 2016 at 9:16 am #196980
    rocketeer
    Member

    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 #196984
    Brad Dalton
    Participant

    You 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.


    Tutorials for StudioPress Themes.

    December 4, 2016 at 10:00 am #196989
    rocketeer
    Member

    Thanks! 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 #196990
    Brad Dalton
    Participant

    You want to add additional schema or modify the default?


    Tutorials for StudioPress Themes.

    December 4, 2016 at 11:47 am #196991
    rocketeer
    Member

    I 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
    SiteNavigationElement

    When I run my front page on the AltitudePro theme, I find:

    WebPage
    Organization
    WPHeader
    CreativeWork
    SiteNavigationElement

    So 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.html

    And 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 #196993
    Brad Dalton
    Participant

    Using the filters is the best option i think.


    Tutorials for StudioPress Themes.

    December 4, 2016 at 4:04 pm #197015
    rocketeer
    Member

    I 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 #197019
    Brad Dalton
    Participant

    Yes. the filter functions are the most flexible.


    Tutorials for StudioPress Themes.

    December 4, 2016 at 6:55 pm #197024
    jdenning
    Participant

    I 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 #197062
    rocketeer
    Member

    If 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 #197064
    Brad Dalton
    Participant

    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>

    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.


    Tutorials for StudioPress Themes.

    December 5, 2016 at 11:10 am #197065
    rocketeer
    Member

    Maybe this plugin would work: https://wordpress.org/plugins/meta-box/

    December 5, 2016 at 11:21 am #197067
    Brad Dalton
    Participant

    For the input yes. Then you need to output in multiple positions. This can be done using custom fields with genesis hooks.


    Tutorials for StudioPress Themes.

    December 5, 2016 at 12:17 pm #197074
    Victor Font
    Moderator

    Learn 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 #197418
    paulang
    Member

    Hey 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 #197419
    paulang
    Member

    I 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 #197426
    Brad Dalton
    Participant

    This plugin worked well when i tested it some time ago.


    Tutorials for StudioPress Themes.

    December 12, 2016 at 1:32 am #197448
    vouchermedia
    Member

    Thanks 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.


    Discount Codes UK

  • Author
    Posts
Viewing 18 posts - 1 through 18 (of 18 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble