WordPress.org

Ready to get started?Download WordPress

Forums

Widget in div on Static "front" Page - Is it possible? (2 posts)

  1. keysuuh
    Member
    Posted 1 year ago #

    I have a static page as a home page.
    Front - Main
    Posts - News

    I'd like to add a widget inside of a div on the main page. That way I can easily add a new video ect inside that div without having to open main.php and add updates there.

    Is there anyway I can do this without any plugins?

  2. JochenT
    Member
    Posted 1 year ago #

    In your functions.php register a dynamic sidebar area:

    register_sidebar( array(
    		'name' => 'Main Sidebar',
    		'id' => 'main-sidebar-1',
    		'description' => 'Here you can place widgets for the main page',
    		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    		'after_widget' => "</aside>",
    		'before_title' => '<h3 class="widget-title">',
    		'after_title' => '</h3>',
    	) );

    This sidebar appears in the widgets admin page, now. You may add your widgets.

    In your main page template put a call to your new sidebar area dynamic_sidebar( 'main-sidebar-1' )

    Probably you need some additional DIV to get proper results.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.