0

I am developing a theme which has an area of the sidebar which displays the blog owner's bio and photo as a background image. I could hard-code this information, however, I'd like to learn how to make this text (and possibly the background image) editable in the WordPress admin. I think this is referred to as a widget, but apart from reordering widgets, I'm not sure how to create one with editable fields.

1 Answer 1

1

There are two ways to see it:

  1. Sidebar as a general area of site layout
  2. Sidebar as container, filled with WordPress widgets

Or maybe combination of the two.

The prime reason to use WordPress widgets is that they provide roughly consistent experience, can be easily used multiple times, and can be enhanced with related functionality (such as conditional/contextual display).

The prime reason not to is that they are somewhat inconvenient to code, let users go too wild, and are painful to easily manage state of (no version control for whatever users configured up and such).

Accordingly there is a choice how to treat that information in your case, depending on your priorities:

  1. You could provide a custom widget and let users use it. If they are already proficient with WordPress widgets then there will be minimal overhead for them to figure it out. See Widgets API.

  2. You could provide a theme settings page and include editable data there, controlling how is it output by code. This will put you in more control over display, rather than users. See Settings API.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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