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

shahardekel
shahardekel
20,306 Points

Looking for a convenient way to embed banners in a wordpress theme?

Hi all,

I'm in the process of coding a custom theme which has a few banners and I'm was looking for a way to add an easy-to-use wordpress admin interface to let the site admin edit/change the banners by himself.

I know custom fields can be used, but I think for some users it's not easy enough and there should be an easier, 'idiot-proof' way. I was thinking about a way to update banner which can be as simple as choosing an existing file from the media library, but I don't know if it's possible "out of the box" or how to approach it.

Perhaps there are other easy ways someone encountered or maybe a plugin I can use or learn from it?

Thanks for the help

4 Answers

Adam Soucie
PLUS
Adam Soucie
Courses Plus Student 8,710 Points

Outside of custom fields, you'd have to write a plugin that does basically the same thing as a custom field. It's a lot of work for something that's already there, but you do get the added bonus of being to control the interface.

Matt Campbell
Matt Campbell
9,767 Points

Why not look at a slider plugin like LayerSlider? You can name each slider in relation to where it appears on the site and then just place the correlating shortcode in the template. Then it's just a case of them selecting from the media library the correct image and there's a tonne of options for them to make there own banners there in the plugin with HTML and CSS if they're inclined to.

shahardekel
shahardekel
20,306 Points

Hi Matthew, this looks like a great plugin, but it's a total overkill. I have simple static images either as <img> tags or as background-image in css. In this case there's no javascript involved, so I wouldn't want to load a heavy plugin.

shahardekel
shahardekel
20,306 Points

Thanks Adam. I was hoping there was something similar built-in to wordpress without using plugins, but I guess there isn't.