I have this site where most of the Homepage is programmed into the php page. For example: a photo slider, a list of the most recent products, etc.

I also need to add a piece of static text to only the Homepage. It's easy just to add it on the php page, but it should be editable from the admin area. Is there a plugin that will allow me to do something like that?

  • Just use a plain text widget. – kaiser Feb 20 '12 at 18:10

If you'd like to create a dedicated widget area for this plain text content, you can create your own 'sidebar' snippet in the location of your page where you'd like it to be editable. (I'm using the term sidebar here, but a sidebar can be placed anywhere in your template, not just in the side bar For example, in the template file add this code:

<!-- begin custom sidebar -->
    <?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Static Text Widget')) :
        (place any code or content here that should show up if no widget is active)
    <?php endif; ?>
<!-- end custom sidebar -->

Next, in your function.php file, tell WordPress about your new widget area:

if (function_exists('register_sidebar')) {
        'name'=>'Static Text Widget',
        'before_widget' => '<div id="%1$s" class="widget %2$s">',
        'after_widget' => '</div>',
        'before_title' => '<h4 class="widgettitle">',
        'after_title' => '</h4>',

You can customize the classes and ids that are placed around the widget and widget title using the parameters you see above. (To help style it if you want).

Now you can just drag and drop the Text widget into your new sidebar from Appearance > Widgets in the admin menu.

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.