• 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

Flexible Widget Classes Question

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 › Flexible Widget Classes Question

This topic is: not resolved

Tagged: Flexible Widgets, Showcase Pro

  • This topic has 2 replies, 2 voices, and was last updated 9 years, 10 months ago by Tom.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • March 17, 2016 at 5:16 am #181635
    Tom
    Member

    I have started playing around with the Flexible Widgets from Showcase Pro. For the First Widget Area on the Front Page, I'm trying to achieve a Widget layout like so:

    100% Full Width
    25% 25% 25% 25%
    100% Full Width

    As soon as I add the 6th Widget, the class .flexible-widgets.widget-halves .widget {width: 50%;} is added to the 2nd, 3rd, 4th and 5th Widgets.

    How would I go about achieving a layout like this?

    March 19, 2016 at 8:04 am #181857
    Victor Font
    Moderator

    Depending on your content, you may be better off using text widgets and column classes rather than flexible widgets. Here is a link to the flex widget layouts: http://my.studiopress.com/setup/cafe-pro-theme/home-page-setup/home-page-widget-layout-configurations/. You'd have to change a lot of code to make flex widgets work the way you want.


    Regards,

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

    March 22, 2016 at 9:30 am #182023
    Tom
    Member

    Hi Victor,

    Thanks for the input, I found a solution in the end by playing around with the PHP for Flexible Widgets. This is probably not the best practice:

    Before:

    //* Flexible widget classes
    function rmo_widget_area_class( $id ) {
    
    	$count = rmo_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 even';
    	}
    	return $class;
    
    }

    After:

    //* Flexible widget classes
    function rmo_widget_area_class( $id ) {
    
    	$count = rmo_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 % 5 == 1 ) {
    		$class .= ' widget-fourths';
    	} elseif( $count % 2 == 0 ) {
    		$class .= ' widget-halves uneven';
    	} else {
    		$class .= ' widget-halves even';
    	}
    	return $class;
    
    }
  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 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