• 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

.shrink in Centric Pro

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 › .shrink in Centric Pro

This topic is: resolved

Tagged: bamajr, centric pro, css, filter, header, html, php, Shrink

  • This topic has 1 reply, 1 voice, and was last updated 10 years, 4 months ago by bamajr.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • November 19, 2015 at 7:11 am #171504
    bamajr
    Participant

    The .shrink class is presently added to:

    
    <header class="site-header" itemscope="" itemtype="http://schema.org/WPHeader">
    

    ...in the global.js file, using the following code:

    
    $(window).scroll(function () {
         if ($(document).scrollTop() > 1 ) {
              $('.site-header').addClass('shrink');
         } else {
              $('.site-header').removeClass('shrink');
         }
    });
    

    So if one wanted to add the .shrink class, after the .site-header class, using php in the functions.php file, how would one go about doing it?

    http://homes.forsalein.io
    November 19, 2015 at 10:02 am #171525
    bamajr
    Participant

    Had I known I could have done this with a pre-existing filter, I wouldn't have wasted so much time trying to construct a PHP DOMDocument Function. Either I or Google missed this filter, when I was searching for a solution.

    Searching for what I thought was going to be PHP DOMDocument Function help, I stumbled across someone who knew the filter it needed (See: http://stackoverflow.com/a/33808160/5581540).

    
    add_filter( 'genesis_attr_site-header', 'my_custom_genesis_header_class' );
    function my_custom_genesis_header_class( $attributes ) {
        $attributes['class'] .= ' shrink';
        return $attributes;
    }
    

    Thank you @silver

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • The topic ‘.shrink in Centric Pro’ is closed to new replies.

CTA

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

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 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