Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Konrad Pilch
Konrad Pilch
2,435 Points

How do i make widgets that i can then put in navbar?

How do i make widgets that i can then put them via admin dashboard ?

So i make a box with blue outline, and apply it to every single widget that the user will put, is there any way? static sidebar with e.g pictrue, archives with pictures, latest posts with pictures, social buttons, etc.. whatever the user wants, would be mine style .

2 Answers

Yes, you can add classes by expanding the widget you want to style and adding a class to it, here is a great tutorial on that:

http://www.wpbeginner.com/wp-themes/how-to-add-custom-styles-to-wordpress-widgets/

Konrad Pilch
Konrad Pilch
2,435 Points

Reading it a little bit, can i just basically inspect the element and apply new style to it?

That would be ok?

You can always use specificity or cascade overrides to style the css instead of adding a new class, but keep in mind that it would become messy overtime especially if you have two similar widgets that you want to style differently. Adding a new class to the widget itself helps mitigate against that.

I may not be understanding you, but I think you want to create your own custom widgets? Or are you trying to put a new widget location in the navbar area?

Konrad Pilch
Konrad Pilch
2,435 Points

What i mean is :

When you log in into the Dashboard, and go to add widgets, they will look ugly not styled. I want them all, to have a class of e.g. box , and widget-heading, widget-body etc.. so they look my style.

When i looked at the widgets that are aviable, there are quite a lot of them, and im wondering , if i can put a class like box for all of them and make them look like i want.

Or do i need to make every single one in functions ( i dont know how really ) and delete others? like archive etc??

I want the widget area to look like mine widgets so i have a pucture, i have social icons, i have archive, recent or most popular food but i want them all to have a class of box, then with headings have widget-heading, and the body widget-body etc..