Support » Theme: Chaplin » Additional footer widget

  • Resolved devilsinkpot

    (@devilsinkpot)


    Hi Anders, Hi Board!

    I’d like to add an additional footer widget are. A simple div that should hold a text-widget with a text claim for the site. I’m running a child-theme.

    Could you or someone who knows please help me, if I can “add” the third widget area via child copies or do I have to replace the two specified areas from you?

    Thanks for your advice.

    Dev

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi there,
    There are several ways to to do this.The easiest way would be to not use the footer widgets at all and instead use a column block with three columns.

    A more complex way to accomplish this: In your child theme you can add support for a third widget by creating an extra sidebar in your functions.php.

    https://developer.wordpress.org/themes/functionality/sidebars/
    (you can also look at the functions.php of Chaplin as a reference).

    Copy the footer.php to your child theme and add the extra sidebar.
    Also adjust the CSS to make sure all widgets appear to your liking.

    Here is a little code example that can help:
    Place this in the functions.php of your child theme:

    add_action( 'widgets_init', 'chaplin_extra_sidebar' );	
    function chaplin_extra_sidebar() {
        register_sidebar( array(
            'name' 			=> __( 'Footer #3', 'chaplin' ),
            'id' 			=> 'footer-three',
            'description' 	=> __( 'Widgets in this area will be displayed in the third column in the footer.', 'chaplin' ),
        ) );
    }

    This adds support for a third footer widget.

    Copy the footer.php of the Chaplin theme to your child theme folder and change this between line 13 and 39

    				<?php if ( is_active_sidebar( 'footer-one' ) || is_active_sidebar( 'footer-two' )  || is_active_sidebar( 'footer-three' ) ) : ?>
    
    					<div class="footer-widgets-outer-wrapper border-color-border section-inner">
    					
    						<div class="footer-widgets-wrapper grid tlcols-3">
    
    							<?php if ( is_active_sidebar( 'footer-one' ) ) : ?>
    								<div class="footer-widgets column-one grid-item">
    									<?php dynamic_sidebar( 'footer-one' ); ?>
    								</div>
    							<?php endif; ?>
    
    							<?php if ( is_active_sidebar( 'footer-two' ) ) : ?>
    								<div class="footer-widgets column-two grid-item">
    									<?php dynamic_sidebar( 'footer-two' ); ?>
    								</div>
    							<?php endif; ?>
    
    							<?php if ( is_active_sidebar( 'footer-three' ) ) : ?>
    								<div class="footer-widgets column-three grid-item">
    									<?php dynamic_sidebar( 'footer-three' ); ?>
    								</div>
    							<?php endif; ?>
    
    						</div><!-- .footer-widgets-wrapper -->
    						
    					</div><!-- .footer-widgets-outer-wrapper -->

    I also changed the class from tcols-2 to tlcols-3 so the width changes as well. Goodluck.

    Thread Starter devilsinkpot

    (@devilsinkpot)

    Thank you so much, @bianca205 !

    Your modification works perfectly for me.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Additional footer widget’ is closed to new replies.