• I just noticed that all 4 of my footer widgets disappear when I add a widget to either one of the 2 sidebars. Is there a common cause for this?

    This is in my functions.php file (custom theme I am developing):

    /* Main Sidebars
    ****************
    Registering the primary and secondary sidebars for 2 and 3 column layouts
    *************************************************************************/
    
    register_sidebar(array(
    
    	'name'          => __( 'Primary Sidebar' ),
    	'id'            => 'primary-sidebar',
    	'description'   => '',
    	'class'         => '',
    	'before_widget' => '<li id="%1$s" class="widget %2$s">',
    	'after_widget'  => "</li>\n",
    	'before_title'  => '<h4 class="widgettitle">',
    	'after_title'   => "</h4>\n",
    ));
    
    register_sidebar(array(
    
    	'name'          => __( 'Secondary Sidebar' ),
    	'id'            => 'secondary-sidebar',
    	'description'   => '',
    	'class'         => '',
    	'before_widget' => '<li id="%1$s" class="widget %2$s">',
    	'after_widget'  => "</li>\n",
    	'before_title'  => '<h4 class="widgettitle">',
    	'after_title'   => "</h4>\n",
    ));
    
    /* Footer Widget Areas
    **********************
    Registering the 4 widget areas of the footer
    ********************************************/
    
    register_sidebars(4, array(
    
    	'name'          => __('Footer %d'),
    	'id'            => 'footerwidget-$i',
    	'description'   => '',
    	'class'         => '',
    	'before_widget' => '<li id="%1$s" class="widget %2$s">',
    	'after_widget'  => "</li>",
    	'before_title'  => '<h4 class="widgettitle">',
    	'after_title'   => "</h4>",
    ));
Viewing 13 replies - 1 through 13 (of 13 total)
  • Thread Starter jstudios

    (@jstudios)

    Still happening.

    What theme are you using? Where did you download it from?

    Thread Starter jstudios

    (@jstudios)

    My own, I built my own parent theme to use on clients. Let me know what you need.

    Theme works just as I need, expect the footer widgets issue.

    How are you calling the footer widgets in footer.php?

    Thread Starter jstudios

    (@jstudios)

    Here is my footer.php in its entirety:

    <span class="clearfix"></span>
    
    </div><!-- #main -->
    
    <?php $options = get_option( 'jframe_theme_options' ); ?>
    
    <footer id="footer">
    
    <?php if ( isset( $options['showfooterwidgets'] ) ) { ?>
    
    	<section id="footer-widgets">
    
    	<?php
    		dynamic_sidebar('Footer 1');
    		dynamic_sidebar('Footer 2');
    		dynamic_sidebar('Footer 3');
    		dynamic_sidebar('Footer 4');
    	?>
    
    	<span class="clearfix"></span>
    
    	</section><!-- #footer-widgets -->
    
    <?php } ?>
    
    	<div id="footer-container">
    
    	<div id="footer-content" class="leftFooterContent">
    		<?php if ( isset( $options['leftfootercontent'] ) ) {
    			echo do_shortcode( $options['leftfootercontent'] );
    		}
    		?>
    	</div>
    
    	<div id="footer-content" class="rightFooterContent">
    		<?php if ( isset( $options['rightfootercontent'] ) ) {
    			echo do_shortcode( $options['rightfootercontent'] );
    		}
    		?>
    	</div>
    
    	<div id="footer-content" class="middleFooterContent">
    		<?php if ( isset( $options['middlefootercontent'] ) ) {
    			echo do_shortcode( $options['middlefootercontent'] );
    		}
    		?>
    	</div>
    
    	</div><!-- #footer-container -->
    
    	<span class="clearfix"></span>
    
    	<?php wp_footer(); ?>
    
    </footer><!-- #footer -->
    
    </div><!-- #wrapper -->
    
    </body>
    
    </html>

    What happens if you remove the <?php if ( isset( $options['showfooterwidgets'] ) ) { ?> conditional?

    Thread Starter jstudios

    (@jstudios)

    I have a whole div container dedicated to the footer widgets. Under Theme Options I can elect if I wish to enable the footer widgets or not. That conditional will display the footer widgets area if checked under Theme Options. That way, if someone doesn’t wish to use footer widgets, there won’t be an empty div at the bottom, but instead it will be removed completely.

    I removed it and everything works fine, I even added a widget to the main sidebar without losing the footer widgets. But I WILL be needing that conditional because of the way the theme is built.

    It sounds like there’s an issue with the value in your theme option. Have you tried echoing its value out to the page?

    Thread Starter jstudios

    (@jstudios)

    I did the following and the output is “1”.

    <?php echo $options['showfooterwidgets']; ?>

    Assuming a value of 1 means “show widgets”, try:

    <?php if ( isset( $options['showfooterwidgets'] ) && $options['showfooterwidgets'] == 1 ) { ?>

    Thread Starter jstudios

    (@jstudios)

    Alright, I did that and added a main widget successfully without loosing the footer widgets. I’ll keep an eye out on how it works out and if I have any issues I’ll rebump the thread.

    Many thanks!!!

    Glad to hear that it’s working so far.

    Thread Starter jstudios

    (@jstudios)

    It’s happening again… πŸ™

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘M footer widgets disappear when I add a new sidebar widget…’ is closed to new replies.