Get the id or the order of the first widget in a wordpress sidebar?

You should make dynamic sidebar that would add numbering to classes or ids of widgets. Here is nice post about it: wordpress.org/support/topic/how-to-first....

Up vote 0 down vote favorite share g+ share fb share tw.

Am using wordpress. In the backend of my site, there is one sidebar. On this sidebar, there are n widgets.

I would like to add a css class just in the first widget and no the rest. How can I handle that? Please help!

Wordpress wordpress-theming link|improve this question asked Dec 16 '10 at 13:57Mamadou312112 42% accept rate.

You can put html into widgets, so you can replicate the content of your widget if it's something simple - you can also put ID-s and classes into html (and edit the css in style. Css file of your theme), or you can even use css directly with style="" tag option. If it's not something simple then it already has IDs and/or classes - so you should get those IDs and classes with firebug, and then edit the styling in style.css.

OK, sometimes a user can re-arrange the order of widgets. The first become the last and the second the first....for exemple. I want have a css class in the the first widget ( at the top).

When it becomes the second, the css class will be appliyed to new in the top. – Mamadou Dec 16 '10 at 15:36.

I've not had a great deal of experience with the widget hooks in WordPress, but I believe this should cover what you're asking. $widget_data_array ) { if( $widget_id! = $first_widget ) continue; if( isset( $widget_data_array'classname' ) ) $wp_registered_widgets$widget_id'classname' .

= ' first_widget'; } }? > You simply need to replace your-sidebar-id-here (line 3 of the code) with a valid sidebar ID(that is, the ID set when the sidebar is registered). Code can be placed inside the theme's functions.

Php for convenience. If you have trouble placing the code just make sure you're not nesting PHP tags.. (eg. Php.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions