0

I'd like to make my theme mobile friendly by turning the widget-containers into touchable buttons, having their contents flying out when hovering. Therefor, I will have to absolutely position the content of each container a few pixels more than its previous one.

Well, I could achieve that by planning how to arrange the widgets before the site goes live and then rely on the class-names WP generates commonly, but since I wanna leave the order up to the customer, this is not a solution.

The trick would be to pass each widget a class name in regard to its position in range. Is there a way to do this?

  • You could register many widget-areas, and rely on each one having its own unique wrapper class, to identify them one by one. Not sure how many you need. – GhostToast Jul 2 '13 at 13:15
  • Hmm this Dosen't seem to be a clean solution since it won't prevent users from placing multiple widgets in each area... Thanks anyway! – Circuit Circus Jul 3 '13 at 7:18
0

Wow, first question I finally found the answer to by myself :-)

I found it here at the WordPress forum. This post offers a correct code-snippet to add an index number to each widget plus to pass a widget-first/widget-last-class to the first/last one. Works like a charme!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.