WordPress.org

Ready to get started?Download WordPress

Forums

Moving a widget (6 posts)

  1. dvanderwinden
    Member
    Posted 5 years ago #

    Hello,

    I'm facing an issue. At the moment I'm using WordPress 2.7.1 with the plugin Mailpress installed. This contains a widget, which is used to subscribe to a mailinglist, as you might know.

    Now, what I want to achieve is to move the widget to the top of the website, to make it replace the search bar.

    Is this possible in any way? Better: is it possible to move the widgets in WordPress from the sidebar, at all?

    Greets.

  2. esmi
    Forum Moderator
    Posted 5 years ago #

    You'd need to widgetize the relevant template file.

  3. dvanderwinden
    Member
    Posted 5 years ago #

    Any docs available for that?

  4. esmi
    Forum Moderator
    Posted 5 years ago #

    Only http://codex.wordpress.org/Widgetizing_Themes.

    It talks about sidebars but you can use exactly the same approach in any template file. For example, I've created a few home page templates that include this snippet:

    <?php the_content(); ?>
    
    <?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('Homepage')) : ?>
    <?php endif; ?>

    Then in functions.php, I have:

    if (function_exists('register_sidebar')) {
    	register_sidebar(array(
    		'name'=> 'Main',
    		'id' => 'main',
    		'before_widget' => '<div class="widget_box side">',
    		'after_widget' => '</div>',
    		'before_title' => '<h3>',
    		'after_title' => '</h3>',
    	));
    	register_sidebar(array(
    		'name'=> 'Homepage',
    		'id' => 'homepage',
    		'before_widget' => '<div class="widget_box">',
    		'after_widget' => '</div>',
    		'before_title' => '<h3>',
    		'after_title' => '</h3>',
    	));
    }

    Hope that helps.

  5. dvanderwinden
    Member
    Posted 5 years ago #

    Cool, I'll try to work it out. I'll contact you if I can't get it to work, if that's OK with you.

    Thanks so far!

  6. leecat151
    Member
    Posted 4 years ago #

    Not sure if this is the place for this but I thought I might give it a whirl. I am using qtranslate in my theme but I want to take the flags in the theme and move them insided the header anysuggestions. thanks in advance

    leedixon

Topic Closed

This topic has been closed to new replies.

About this Topic