Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save jeremyescott/11bd2195320a8836586d03aebe073dd8 to your computer and use it in GitHub Desktop.

Select an option

Save jeremyescott/11bd2195320a8836586d03aebe073dd8 to your computer and use it in GitHub Desktop.

Revisions

  1. jeremyescott created this gist May 3, 2017.
    17 changes: 17 additions & 0 deletions add_ID_attribute_to_main_element_genesis
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    // https://www.itnota.com/adding-id-attribute-genesis-main-content/
    //
    // Adds consideration for high level error reporting

    // Add id="content" attributes to <main> element
    add_filter( 'genesis_attr_content', 'my_attr_content' );

    function my_attr_content( $attr ) {

    if( array_key_exists( 'id', $attr ) {
    $attr['id' .= 'content';
    } else {
    $attr['id'] = 'content';
    }
    return $attr;

    }