Sridhar Katakam

Genesis and WordPress Tutorials

Themes

  • Home
  • About
  • Archive
    • By Child Theme
  • Membership
    • FAQ
  • Forums
    • Members-only
      • Tutorial Requests
    • Paid Support
  • Contact
  • Login

How to replace class with an ID for Title Area in Genesis

May 12, 2017 by Sridhar Katakam Leave a Comment Favorited: 0 times

In the members-only forum, a user asked:

Hi All
> I’m a bit stuck on using attributes to alter markup.

I’d like to replace the title-area css class with an ID of title-area and I’d rather not rewrite the do_header area.

This can be done using genesis_attr_<context> filter hook.

Add this in child theme’s functions.php:

add_filter( 'genesis_attr_title-area', 'custom_title_area_markup' );
/**
 * Replace `title-area` class with a ID for div.title-area
 *
 * @param array $attributes attributes of HTML element which are assembled into the output.
 * @return attributes of HTML element which are assembled into the output.
 */
function custom_title_area_markup( $attributes ) {
    $attributes['class'] = '';

    $attributes['id'] = 'title-area';

    return $attributes;
}

Before:

After:

Reference: genesis/lib/structure/header.php.

Filed Under: Free Content, Genesis Tagged With: genesis_attr

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Comments

  • Sridhar Katakam on BrowserSync in Laravel Valet
  • Bharti on How to add a new website in Google Analytics
  • Chuck Smith on BrowserSync in Laravel Valet
  • arunkumar on BrowserSync in Laravel Valet
  • Craig Simpson on BrowserSync in Laravel Valet
  • Sridhar Katakam on BrowserSync in Laravel Valet
  • arunkumar on BrowserSync in Laravel Valet
  • Vajrasar on BrowserSync in Laravel Valet
  • fatcatdesign on Multiple Rotating Background images with Ken Burns Effect in Altitude Pro
  • admin@heyitsfree.net on How to load Font Awesome 5 in WordPress

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new tutorials by email.

Join 1,042 other subscribers

Categories

Tags

ACF ACF Pro Agency Pro Altitude Pro Background Video Backstretch Centric Pro CPT CSS Grid Digital Pro dynamik equal heights featured image fixed Fixed header Flexbox font awesome footer footer widgets Genesis Sample grid header Infinity Pro Isotope jQuery lightbox Masonry Metro Pro minimum-pro Monochrome Pro Outreach Pro page template parallax Parallax Pro portfolio pre_get_posts responsive search Showcase Pro slider Soliloquy sticky Video Background widget area WooCommerce
Follow @srikat

Recent Posts

  • BrowserSync in Laravel Valet
  • How to dynamically load posts on click using Ajax in Genesis
  • Multiple Rotating Background images with Ken Burns Effect in Altitude Pro
  • Secondary logo on scroll in Business Pro
  • Site Title – Custom Menu – Primary Menu in Genesis
  • Rotating Background Images for Page Header section using Featured Galleries and Backstretch in Business Pro
  • Header Right widget area in Genesis Sample 2.6.0
  • Utility Bar in Genesis Sample
  • CSS Grid with Float Fallback
  • Font Awesome 5 SVG icons above menu items in Genesis

Find my tutorials helpful and wish to donate?

© 2018 · Genesis Sample Theme on Genesis Framework