Widgets in custom sidebar disappearing but staying active
-
I’ve kind of been forced to dive into WordPress head first, so I’m trying to do a lot with novice knowledge of WordPress and virtually no knowledge of PHP.
I am using a wordpress.org installation (3.3), and using a Sandbox Child theme.
To kind of exemplify my skill level and show to what extent I’ve modified my theme: (skip below for my actual question)
I’ve made very little use of the fuctions.php, due to my lack of PHP experience and have been copying over and modifying page.php and such manually. For example, to change the default sidebars to be on either side of the content, I figured out how to separate the sidebars into separate files and then go into each page/index/single etc. to move the sidebars to where I want them. Not sure if that’s how its supposed to be done, but that’s the way it is.
My question/problem is:
I’ve added a ‘sidebar’ to the header, created with functions.php.functions.php
register_sidebar( array( 'name' => sprintf(__('Masthead %d'), $i ), 'id' => 'masthead-$i', 'description' => 'Place an image or text here to appear next to the logo. Putting anything here will hide the links in the masthead', 'before_widget' => '<div id="%1$s" class="widget %2$s mhWidget">', 'after_widget' => '</div>', 'before_title' => '<h2 class="mhTitle">', 'after_title' => '</h2>' ));' header.php code relevant to the sidebar:<div id=”masthead” class=”mhLinks”><?php if ( !function_exists(‘dynamic_sidebar’) || !dynamic_sidebar(“masthead-0”) ) : ?>
<div id=”mhDonate” class=”mhLinks”><p>Donate</p></div><div id=”mhJoin”><p>Join</p></div><div id=”mhContact”>`Now, when I add a widget to my “Masthead 0” sidebar, it will appear on the page. When I go back to the widget admin panel, the “Masthead 0” box is empty and the widget has vanished, however the widget continues to appear in the header. If I add a new widget to “Masthead 0”, it will switch on the page, but still disappears in the admin panel. What on earth is going on and how do I fix it?
Additional note: When I added the sidebar to the header, it messed up the original/default sidebars. I had to go into sidebar-left.php and sidebar-right.php and change them from ‘1’ and ‘2’ to ‘2’ and ‘3’.
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(3) ) : // begin secondary sidebar widgets ?> -
You did not specify a blog address or reason for posting when you created this topic.
This support forum is for blogs hosted at WordPress.com. If your question is about a self-hosted WordPress blog then you’ll find help at the WordPress.org forums.
If you don’t understand the difference between WordPress.com and WordPress.org, you may find this information helpful.
If you forgot to include a link to your blog, you can reply and include it below. It’ll help people to answer your question.
This is an automated message.
-
- The topic ‘Widgets in custom sidebar disappearing but staying active’ is closed to new replies.