Home    Articles


How to display the sidebar contents/widgets in wordpress with php


When you develop a new theme or change a theme, you'll probably want to use all the sidebars: Main Sidebar, Fist Front Page Widget Area, Second Front Page Widget Area.

The question you will ask is: How do i display the conted of a specific Widget Area?

The answer is:

dynamic_sidebar( 'sidebar-1' ); // The Main Sidebar
dynamic_sidebar( 'sidebar-2' ); // The First  Front Page Sidebar
dynamic_sidebar( 'sidebar-3' ); // The Second Page Sidebar

All these sidebars are from wordpress admin area, there you can configure the widgets position and much more.See picture bellow.