Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

is there a way that i can place a certain widget any where on the site.

For example:

I'm using the text widget in my sidebar, for the title i put youtube, and i placed the youtube embed code in it.

But i want that widget to go at the top of the site how do i make this possible, while still using the widgets menu, but not show up in the sidebar, but wherever i place it?

If it's not possible, does anyone know of a youtube sidebar widget, one that can let you place the widget code anywhere on the site and also do it from the widgets menu.

share|improve this question
    
you need to create a custom widget area in your theme , and then in the widgets menu assign the widget to that area. –  krembo99 Mar 9 '12 at 2:59

2 Answers 2

up vote 0 down vote accepted

Just register another widget area. Don’t take the name sidebar literally, you can use the fields anywhere on your page.

In your theme’s functions.php:

add_action( 'after_setup_theme', 'register_multiple_widget_areas' );

function register_multiple_widget_areas()
{
    register_sidebar(
        array(
        'name'          => 'Sidebar',
        'id'            => 'sidebar',
        'description'   => 'describe the function of the box.'
        )
    );
    register_sidebar(
        array(
        'name'          => 'Header',
        'id'            => 'header-widget',
        'description'   => 'Goes at the top of the page.'
        )
    );
}

And wherever you need the header widget call:

dynamic_sidebar( 'header-widget' );

See also register_sidebar() and dynamic_sidebar().

share|improve this answer
    
Thank you, worked like a charm –  Terrell Anderson Mar 9 '12 at 9:38

You can use the_widget().

share|improve this answer
    
and add what to it, the title of the text widget? –  Terrell Anderson Mar 9 '12 at 0:05
    
I guess you need to re-write your Q. I'm not quite sure if I understand. –  kaiser Mar 9 '12 at 1:12
    
@The downvoter: Comment appreciated. –  kaiser Mar 9 '12 at 3:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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