• 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

Infinity Pro Flexible Widgets: Trouble with 2 rows, 4 widgets

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 › Infinity Pro Flexible Widgets: Trouble with 2 rows, 4 widgets

This topic is: resolved

Tagged: Flexible Widgets

  • This topic has 3 replies, 2 voices, and was last updated 8 years, 11 months ago by MissKitty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • August 1, 2017 at 5:24 pm #209857
    MissKitty
    Participant

    Using Infinity Pro, on the Front Page 4 section I’d like to accomplish this.

    The theme setup instructions dictate this configuration as:

    Four widgets will display as two (2) rows. The first row will display full width. The second row will display as three (3) columns equal to approximately one-third the width of the widget area.

    So I’m using 4 widgets. However, instead of one row full width followed by a second row of three equal columns, I’m getting one full-width, followed by (4) 25% width columns, with the last column on the second row empty, like this.

    Since I’ve customized the widget ID (in functions.php and front-page.php) from 'front-page-4' to 'our-services’, I'm assuming I missed further edits required for this to work properly. Any takers? 🙂

    http://greenhorizons.dev.onpressidium.com/#our-services
    August 1, 2017 at 7:40 pm #209863
    Victor Font
    Moderator

    There are 2 functions in functions.php that determine the class to add to the flexible widget area to display the second row. This is the code in functions.php:

    // Setup widget counts.
    function infinity_count_widgets( $id ) {
    
    	global $sidebars_widgets;
    
    	if ( isset( $sidebars_widgets[ $id ] ) ) {
    		return count( $sidebars_widgets[ $id ] );
    	}
    
    }
    
    function infinity_widget_area_class( $id ) {
    
    	$count = infinity_count_widgets( $id );
    
    	$class = '';
    
    	if ( $count == 1 ) {
    		$class .= ' widget-full';
    	} elseif ( $count % 3 == 1 ) {
    		$class .= ' widget-thirds';
    	} elseif ( $count % 4 == 1 ) {
    		$class .= ' widget-fourths';
    	} elseif ( $count % 2 == 0 ) {
    		$class .= ' widget-halves uneven';
    	} else {
    		$class .= ' widget-halves';
    	}
    
    	return $class;
    
    }

    The math that calculates the class is the modulus operator. It returns the remainder of a division problem. The first function counts the number of widgets assigned to a widget area, then divides that number by 1, 2, 3, or 4. On your site, the class in use is widget-fourths. The only way the math will return a remainder of 1 when divided by 4 is if it is counting either 1 or 5 widgets. Whatever the case, these functions are not returning the correct values if you have 4 widgets. Four widgets should give you the widget-thirds class. This is what's wrong, but I can't tell you why because I don't have access to your code. Good luck.


    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

    August 2, 2017 at 8:26 am #209903
    MissKitty
    Participant
    This reply has been marked as private.
    August 2, 2017 at 11:56 am #209916
    MissKitty
    Participant

    Update: The incredibly smart and talented Victor Font was able to fix this issue for me by correcting an item in the front-page.php file.

    THANK YOU, VICTOR!

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘General Discussion’ is closed to new topics and 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