Community Forums › Forums › Archived Forums › General Discussion › Infinity Pro Flexible Widgets: Trouble with 2 rows, 4 widgets
Tagged: Flexible Widgets
- This topic has 3 replies, 2 voices, and was last updated 6 years, 8 months ago by MissKitty.
-
AuthorPosts
-
August 1, 2017 at 5:24 pm #209857MissKittyMember
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-servicesAugust 1, 2017 at 7:40 pm #209863Victor FontModeratorThere 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 #209903MissKittyMemberThis reply has been marked as private.August 2, 2017 at 11:56 am #209916MissKittyMemberUpdate: 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!
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.