0

I have a user that is wanting to be able to add items to the side bar (images / text) I'm rather new to wordpress development - fulltime c# developer, so I'm at a loss for a solution. Can anyone advice what the best solution would be? thanks,

3 Answers 3

1

As you seem to understand from your tags, the user (who would need to have admin-level privileges) can add things to a sidebar via Widgets in Appearance > Widgets. For text and images, the default would be to drag the Text widget into the sidebar, then edit to add the text/image reference.

To make this super-easy for your user (assuming they don't have any knowledge of HTML) you could install the plugin Page in Widget. This plugin lets you display the contents of a WordPress "Page" in the sidebar. The user would create a Page, upload images and format their text, then "Publish". Going over to Appearance > Widgets, they'd then drag in the "Page in Widget" widget into the sidebar, choose the correct page from the dropdown, and Save.

If you're looking for a really high-level look at how to administer stuff in WordPress (for either yourself or your users) I recommend http://learn.wordpress.com/ - best of luck!

1

The correct approach is to use dynamic sidebars, which allows the user to add WordPress Widgets. Refer to the Codex entry on Widgetizing Themes.

Basically, you define the dynamic sidebar(s) in functions.php; e.g.:

<?php
function wpse45595_register_dynamic_sidebars() {
    register_sidebar(array( // Top full-width widget area
        'name'=>'Main Sidebar',
        'id'=>'sidebar-main',
        'description' => 'This is the main widget area for the Theme',
        'before_widget' => '<div id="%1$s" class="widget %2$s">',
        'after_widget' => '</div>',
        'before_title' => '<div class="title widgettitle">',
        'after_title' => '</div>',
    ) );
}
add_action( 'widgets_init', 'wpse45595_register_dynamic_sidebars' );
?>

Then, in the appropriate place in the template, e.g. in sidebar.php, you simply call:

<?php dynamic_sidebar( 'sidebar-main' ); ?>

For reference:

0

Actually, you can do this in two ways, either using widgets (and also you can choose to install plugins that enable new widgets) or you can hard-code into sidebar.php

Obviously the latter won't allow your user to add new text/images etc, so you're probably best off with using widgets.

In WP admin, you or your client can Navigate to Appearance -> Widgets and there, you can drag and drop the widgets that you want to show on the sidebar.

You may need to add some code into your sidebar.php file to enable widgets, but most themes have this enabled already.

Standard WP sidebar widgets don't really handle adding images too well, so you could try adding a new plugin to handle that for you, something like this perhaps: http://wordpress.org/extend/plugins/image-widget/

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.