
Using different filters in Genesis Framework we can add number of different HTML markup elements and Attributes at runtime.
Basically it will add ID and CSS Classes in HTML. These HTML markup elements/sections also known as ‘contexts’.
Let’s take a look at below attributes. Genesis framework adds below schema.org attributes into your Genesis WordPress child theme which you could see in HTML code by following below steps:
- Open Chrome
- Load your blog
Right clickon page- Click on
Inspectoption
Google uses these schema.org attributes to well index your site pages/posts into Google Search Engine Result Page (SERP).
$attributes['itemtype'] = 'http://schema.org/WebSite'; $attributes['itemtype'] = 'http://schema.org/WebPage'; $attributes['itemtype'] = 'http://schema.org/SearchResultsPage'; $attributes['itemtype'] = 'http://schema.org/WPHeader'; $attributes['itemtype'] = 'http://schema.org/BreadcrumbList'; $attributes['itemtype'] = 'http://schema.org/ListItem'; $attributes['itemtype'] = 'http://schema.org/SearchAction'; $attributes['itemtype'] = 'http://schema.org/SiteNavigationElement'; $attributes['itemtype'] = 'http://schema.org/CreativeWork'; $attributes['itemtype'] = 'http://schema.org/Person'; $attributes['itemtype'] = 'http://schema.org/Comment'; $attributes['itemtype'] = 'http://schema.org/Person'; $attributes['itemtype'] = 'http://schema.org/Person'; $attributes['itemtype'] = 'http://schema.org/WPSideBar'; $attributes['itemtype'] = 'http://schema.org/WPSideBar'; $attributes['itemtype'] = 'http://schema.org/WPFooter';

Similar way you could add ID attribute too using the genesis_attr_entry filter. It is essential to use this filter.
add_filter( 'genesis_attr_content', 'custom_attributes_content' );
function custom_attributes_content( $attributes ) {
$attributes['id'] = 'content';
return $attributes;
}
Here is an implementation of the filter which you could find in markup.php file from Genesis core theme.
add_filter( 'genesis_attr_content', 'genesis_attributes_content' );
/**
* Add attributes for main content element.
*
* @since 2.0.0
*
* @param array $attributes Existing attributes.
*
* @return array Amended attributes.
*/
function genesis_attributes_content( $attributes ) {
return $attributes;
}
We are using above hook on Crunchify.com site to add custom ID attribute content which we are using in Scroll to Top button.
Happy blogging.
