WP Smith

Creating WordPress & Genesis Websites Since 2010

  • Home
  • About
  • Services
  • Blog
  • Contact

Aug 21 2012

Resize Genesis Footer Widgets to Equal Sizes

This weekend, I wrote a set of code that makes all the footer widgets the same size dynamically, which is perfect for CSS styling. For example, if you wanted side borders on the footer widgets, you were either stuck with unequal vertical bars or setting the footer widgets a specific size for design purposes. However, with this code snippet, then you are good to go.

This code makes the footer widgets the same size if the browser is greater than 960px. If less, it drops it to { height: auto } for you to handle using media queries and other responsive code.

Written by Travis Smith · Categorized: Genesis

StudioPress Premium WordPress Themes     WP Engine Managed WordPress Hosting

What can I do for you!?

Custom Development

We develop plugins by determining both business/functional and technical requirements, following WordPress development best practices, and using agile methodology to ensure you get the best solution.

Consulting

Have questions? Need a reliable developer to consult? Please contact us today!

Customized Theme

We can customize your theme or child theme, or create a child theme for you based on your needs while enhancing the performance of every individual attribute.

Customized Plugin

We can customize your plugins, extend plugins (e.g., Gravity Forms, Jetpack, Soliloquy) based on your needs ensuring security, performance, and positive business impact.

Contact Us

About Travis Smith

As a WordPress enthusiast, developer, and speaker, Travis writes about what he learns in WordPress trying to help other WordPress travelers, beginners and enthusiasts with tutorials, explanations, & demonstrations.

Comments

  1. carrie says

    August 21, 2012 at 8:25 am

    Very nice! Can’t tell you how many times I’ve worked/re-worked the copy to get equal heights. 🙂 Thanks for this!

    Reply
  2. Seth says

    August 22, 2012 at 10:47 am

    Could something similar be set up for a ‘home-middle’ section? I run into more issues on those sections than in the footer it seems.

    Reply
    • Travis Smith says

      August 22, 2012 at 9:42 pm

      Hello Seth,

      Yes it can. Just change the selector variable to the home middle class. So if the home middles shared a similar class, it would work! Same code!

      Thanks,

      Travis

      Reply
  3. Adam W. Warner says

    August 22, 2012 at 5:37 pm

    Travis,
    Is this a function that can be dropped into an existing Genesis child theme’s functions.php file and it will have an immediate effect?

    Reply
    • Travis Smith says

      August 22, 2012 at 9:44 pm

      Hello Adam,

      The PHP code would need to be placed into functions.php or some other file or your core functionality plugin. The JS would then need to be placed into the js folder of your Child theme as a js file. If you are using a core functionality plugin, then the setup is a bit different. Let me know if you need any help.

      Thanks,

      Travis

      Reply
      • Adam W. Warner says

        August 23, 2012 at 6:52 am

        Hi Travis, thanks for the clarification. My intention would be to put the PHP into my child theme’s functions file now (Agency) and move the js file into the js folder of my child theme as you describe above.

        I’ll be trying to use this to change the Home Left, Home Middle, and Home Right widgets so I can add some simple colored borders there for a client site I’m currently working on. The client wants each widget to have one of their three branding colors. ex: Home Left = green border, Home Middle = blue border, Home Right = orange border.

        Is my understanding correct that this will allow me to achieve the above?

        Reply
        • Travis Smith says

          August 23, 2012 at 8:43 am

          Looking at the Agency child theme (home.php), the middle widget areas have the classes home-left, home-middle and home-right. If you change it to where each also have home-widgets-area, then your selector would be #content .home-widgets-area.

          So your new home.php would be something like this (by the way this could be further reduced by using genesis_widget_area(), but in keeping with the current child theme download…):
          [php]
          function agency_home_loop_helper() {

          if ( is_active_sidebar( ‘home-left’ ) || is_active_sidebar( ‘home-middle’ ) || is_active_sidebar( ‘home-right’ ) ) {

          echo ‘<div id="home">’;

          echo ‘<div class="home-left home-widgets-area">’;
          dynamic_sidebar( ‘home-left’ );
          echo ‘</div><!– end .home-left –>’;

          echo ‘<div class="home-middle home-widgets-area">’;
          dynamic_sidebar( ‘home-middle’ );
          echo ‘</div><!– end .home-middle –>’;

          echo ‘<div class="home-right home-widgets-area">’;
          dynamic_sidebar( ‘home-right’ );
          echo ‘</div><!– end .home-right –>’;

          echo ‘</div><!– end #home –>’;

          }

          }
          [/php]

          So then you would change the JS above to something like this:
          [javascript]
          var selector = ‘#content .home-widgets-area’; // added on line 14
          selectorSizing( browserWidth, selector ); //changed line 20 & 65
          [/javascript]

          Reply
  4. Adam W. Warner says

    August 23, 2012 at 1:24 pm

    Thanks so much Travis, I REALLY appreciate you taking the time to post this:) Will be trying it out in the next few days!

    Reply

Leave a Reply Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  • Twitter
  • Facebook
  • LinkedIn
  • Google+
  • RSS

Copyright © 2025 � WP Smith on Genesis on Genesis Framework � WordPress � Log in