Wordpress Themes - WP Forum at BFA
Click Here To DONATE! Support the theme development, get more attention and additional benefits based on your donation level. Your forum name will be highlighted.

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Sidebars & Widgets »

[SOLVED] Add Sequential ID To Each Widget


Build custom WP THEMES, without
coding.
Click here for THEMEFRAME

From the author of Atahualpa, the #1 most
downloaded (700,000+) theme @ wordpress.org
  #1  
Old Jul 27, 2012, 09:32 AM
bswb97
 
139 posts · Aug 2010
I want to add an individual sequentially numbered ID to each widget. In the template code, I have no problem adding the div with ID. However, I don't know how WP calls out a sequential variable. I can't seem to find any clear documentation on this.

For example, if you have three widgets in the sidebar, the source HTML will show:

<div id="widgetcontainer1">...content...</div>
<div id="widgetcontainer2">...content...</div>
<div id="widgetcontainer3">...content...</div>

I have no problem assigning a generic <div id="widgetcontainer"> in the template but I'm not sure how to add the automatic sequential numbering. I have some widgets that call out some messy class assignments, so this will help me simplify for a particular project.
  #2  
Old Jul 27, 2012, 10:13 AM
juggledad's Avatar
juggledad
 
19,981 posts · Mar 2009
OSX 10.6.8/10.7.3 WP 2.8.x/2.9.x/3.x Atahualpa 3.5.x/3.7.x Safari 5.x Firefox 11 XP
Why not just use a plugin like Widget CSS Classes
  #3  
Old Jul 27, 2012, 01:29 PM
bswb97
 
139 posts · Aug 2010
That plugin looks like it would do the trick. I activated it, though, and I didn't see any additional classes added (first/last, even/odd, sequential).

Is there an easy way to do this manually?
  #4  
Old Jul 27, 2012, 01:44 PM
juggledad's Avatar
juggledad
 
19,981 posts · Mar 2009
OSX 10.6.8/10.7.3 WP 2.8.x/2.9.x/3.x Atahualpa 3.5.x/3.7.x Safari 5.x Firefox 11 XP
if you read the doc, it says it adds a field to the widget that you can add other classes to.
  #5  
Old Jul 27, 2012, 06:37 PM
bswb97
 
139 posts · Aug 2010
I heard back from the plugin dev. I had to tweak my version of the theme to support it. Now it works great.

All times are GMT -6. The time now is 02:44 PM.


Powered by vBulletin® Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.