Edit: Foregot to add the first 3 variables.
Here is the code in my functions.php page:
$pagecount = count(get_pages('parent=0'));
$names = array();
$IDs = array();
function getNames() {
$i = 0;
$pages = get_pages();
foreach($pages as $page) {
$name = $page->post_title;
$names[$i] = $name;
$id = $page->ID;
$IDs[$i] = $id;
if ( function_exists('register_sidebar')) {
register_sidebar(array(
'name' => $names[$i],
'id' => $IDs[$i],
'description' => '',
'before_widget' => "<div class='left_mid'>",
'after_widget' => '</div>',
'before_title' => "<h2 class='cusstom'>",
'after_title' => '</h2>'));
}
$i++;
}
}
getNames();
if (function_exists('register_sidebar')) {
//create the default widget. If no text is entered in another widget, the default text will be displayed
register_sidebar(array(
'name' => 'Default',
'id' => 'default',
'description' => 'The default text that should be displayed. Is overridden when text is entered in another widget for the page.',
'before_widget' => "<div class='left_mid'>",
'after_widget' => '</div>',
'before_title' => "<h2 class='cusstom'>",
'after_title' => '</h2>'));
}
The "default sidebar doesnt reset when i refresh the page. All the others do. Why is that?