GeoDirectory SupportMight be worth changing you widget class markup – GeoDirectory Support https://wpgeodirectory.com/support/topic/might-be-worth-changing-you-widget-class-markup/feed Sun, 08 Feb 2026 08:25:27 +0000 http://bbpress.org/?v=2.5.14-6684 en-US https://wpgeodirectory.com/support/topic/might-be-worth-changing-you-widget-class-markup/#post-2707 <![CDATA[Might be worth changing you widget class markup]]> https://wpgeodirectory.com/support/topic/might-be-worth-changing-you-widget-class-markup/#post-2707 Wed, 21 May 2014 08:45:12 +0000 Kevin Heath It might be worth changing your widgets.php file to allow a more specific naming of widgets to :



<div class="widget %2$s">

This then will give each widget a specific name and makes it much easier for developers to use css to remove unnecessary widgets when doing responsive design.

It’s nice to have things like sliders and image widgets for desktops and possibly tablets but for smartphones they add to download times and in many cases are just eye-candy that can be dropped.

An example if you use the above coding in place of just widget in



if(get_option('geodir_show_home_top_section')){
		register_sidebars(1,array('id'=> 'geodir_home_top','name' => __('GD Home Top Section',GEODIRECTORY_TEXTDOMAIN),'before_widget' => '<div class="widget %2$s">','after_widget' => '</div>','before_title' => '<h3><span>','after_title' => '</span></h3>'));

Then the widget for GD>search would be named as:



class="widget geodir_advance_search_widget"

instead of just class=”widget”

It really comes into it’s own though when you start to use text widgets because each text widget then gets assigned its own id rather than just being named widget.

Just a thought

thanks
Kevin

]]>
https://wpgeodirectory.com/support/topic/might-be-worth-changing-you-widget-class-markup/#post-2708 <![CDATA[Reply To: Might be worth changing you widget class markup]]> https://wpgeodirectory.com/support/topic/might-be-worth-changing-you-widget-class-markup/#post-2708 Wed, 21 May 2014 08:57:04 +0000 Kevin Heath whoops

My mistake – wrong identifier

you need to use %1$s and not %2$s otherwise it will not assign individual numbers to multiple text areas etc

Kevin

]]>
https://wpgeodirectory.com/support/topic/might-be-worth-changing-you-widget-class-markup/#post-2733 <![CDATA[Reply To: Might be worth changing you widget class markup]]> https://wpgeodirectory.com/support/topic/might-be-worth-changing-you-widget-class-markup/#post-2733 Wed, 21 May 2014 16:26:40 +0000 Paolo Thanks for the suggestion, I’ve flag this for Vikas…

]]>
https://wpgeodirectory.com/support/topic/might-be-worth-changing-you-widget-class-markup/#post-3345 <![CDATA[Reply To: Might be worth changing you widget class markup]]> https://wpgeodirectory.com/support/topic/might-be-worth-changing-you-widget-class-markup/#post-3345 Sat, 31 May 2014 14:46:25 +0000 Stiofan O'Connor Done, will be in the next version.

Thanks,

Stiofan

]]>