• 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

Cafe Pro and WPML widget issue

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 › Internationalization and Translations › Cafe Pro and WPML widget issue

This topic is: not resolved
  • This topic has 8 replies, 7 voices, and was last updated 2 years ago by garant48.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • May 12, 2015 at 6:41 am #151837
    Chantal Coolsma
    Member

    Hi,

    I am implementing WPML on a site for a customer which uses the Cafe Pro child theme. In the theme functions.php, there is a function which counts the widgets in a widget area and adds a class to that widget area.

    On the homepage I have added two Multilanguage text widgets. Both set to a different language, in order to present the right content for that language. However now it sets the class to "two-widgets" while only one of the two is shown.

    Is there a way to check how much widgets are shown and set the class accordingly?

    May 12, 2015 at 6:02 pm #151934
    Brad Dalton
    Participant

    Link to the site please.


    Tutorials for StudioPress Themes.

    May 13, 2015 at 1:06 am #151968
    Chantal Coolsma
    Member

    It is a development site which isn't reachable from outside. This function counts the widgets, but all widgets. Also widgets which aren't shown in the frontend:

    function cafe_widget_area_class( $id ) {
    	$count = cafe_count_widgets( $id );
    
    	$class = '';
    
    	if( $count == 1 || $count < 9 ) {
    
    		$classes = array(
    			'zero',
    			'one',
    			'two',
    			'three',
    			'four',
    			'five',
    			'six',
    			'seven',
    			'eight',
    		);
    
    		$class = $classes[ $count ] . '-widget';
    		$class = $count == 1 ? $class : $class . 's';
    
    		return $class;
    
    	} else {
    
    		$class = 'widget-thirds';
    		
    		return $class;
    
    	}
    
    }
    
    May 14, 2015 at 4:02 am #152140
    wittermahn
    Member

    those widgets are quite nice 😉

    May 14, 2015 at 4:53 am #152142
    Chantal Coolsma
    Member

    Nobody has a solution?

    April 14, 2017 at 4:44 pm #204802
    lifanovsky
    Member

    Anyone?

    November 12, 2017 at 5:43 am #213494
    borjaav
    Participant

    I have the same problem in one of my sites


    Consultor SEO y Diseñador web freelance

    March 28, 2018 at 8:06 am #218404
    roca969
    Member

    I have the same problem with wpml and the homepage widgets, is there a solution please?

    March 8, 2021 at 11:34 pm #503372
    garant48
    Blocked

    yes I understand the issue that you are facing here because I also faced the similar one when I used it for the first time for mysite but now it ok you have to try again and again it will do better after some tries.

  • Author
    Posts
Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.
Log In

CTA

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

Create a site with WP EngineShop for Themes

Footer

StudioPress

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