Dynamic sidebar widgets moving around
-
I am generating dynamic sidebars for all the root pages on a site like this:
foreach (get_pages(array('parent' => 0)) as $post) { setup_postdata($post); if (!dynamic_sidebar(get_the_title())) { register_sidebar(array( 'name' => get_the_title(), 'before_widget' => '', 'after_widget' => '', )); } wp_reset_query(); }
which works fine… however when I add a new page, the widgets I’ve placed in the sidebars jump around – I guess maybe because it’s recreating these sidebars and the widget relations get lost during this process?
Can anyone tell me how I could do this better?
- The topic ‘Dynamic sidebar widgets moving around’ is closed to new replies.