Register multiple sidebars

You just need to use the alternate syntax for foreach. From the php manual: The foreach construct provides an easy way to iterate over arrays. foreach works only on arrays and objects, and will issue an error when you try to use it on a variable with a different data type or an uninitialized variable. … Read more

$post>ID displays wrong post ID

If i understand correctly you are trying to display a list of child pages of a page in a widget, if so then first check if you are on a page using the conditional tag is_page() then you can use $wp_query->get_queried_object_id() like t31os has pointed out so your widget display function should look like this: … Read more

Different widgets on different page templates?

You will need to create more sidebars in your functions.php file and then edit the page templates to call the sidebar you want. Adding sidebars Go in to your functions.php file. You should see some sidebars already being registered. The code will look something like this: //Adds default sidebar if ( function_exists(‘register_sidebar’) ) register_sidebar(); To … Read more

Get sidebar parameters (before_widget, before_title, etc.) from within a widget

The parameters are given (as an array) as the first argument provided to the widget method. The second argument, $instance, holds the options for that particular instance of the widget. My usual set up is: function widget($args, $instance){ //Extract the widget-sidebar parameters from array extract($args, EXTR_SKIP); echo $before_widget; echo $before_title; //Display title as stored in … Read more

Changing name of sidebar widget

Use the ‘Name’ parameter in your register_sidebar call. E.g., see the following code in the default Twenty Ten theme, line 351. function twentyten_widgets_init() { // Area 1, located at the top of the sidebar. register_sidebar( array( ‘name’ => __( ‘Primary Widget Area’, ‘twentyten’ ), ‘id’ => ‘primary-widget-area’, ‘description’ => __( ‘The primary widget area’, ‘twentyten’ … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)