[Resolved] Footer ?padding/margin left? css with latest update

Home Forums Support [Resolved] Footer ?padding/margin left? css with latest update

Home Forums Support Footer ?padding/margin left? css with latest update

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #268346
    Pete

    Hi Tom the latest update has been a bit of a challenge with the css updates. I’m slowly working through all of it. The footer’s left ?padding doesn’t look the same as before the update. It doesn’t look centered like before but seems to have some left padding that shifts both footer widgets to the right (I have 2 footer widgets). Can you take a look and see what I mean…
    If you look at my content and sidebar center line, the footer widgets doesn’t line up their center line.
    link removed

    #268464
    Tom
    Lead Developer
    Lead Developer

    Are you using a child theme footer.php file?

    The footer widgets are now added using a function/action hook, and a new container has been added into the markup which you need to update your code with.

    #268820
    Pete

    Yep I’ll take a look at it and try to update it with my stuff

    #268858
    Tom
    Lead Developer
    Lead Developer

    Sounds good πŸ™‚

    #268887
    Pete

    Hi Tom, I gotta say I’m not a big fan of the whole template files moving into the “function/action hook” thing, it’s a lot more work for us who use child themes. None the less, could you tell me exactly from/to which lines I need to extract out of the template-tags.php file to play with the footer.php file…. i’m guessing it’s this… thanks.

    if ( ! function_exists( 'generate_construct_footer_widgets' ) ) :
    /**
     * Build our footer widgets
     * @since 1.3.42
     */
    add_action( 'generate_footer','generate_construct_footer_widgets', 5 );
    function generate_construct_footer_widgets() {
    	// Get how many widgets to show
    	$widgets = generate_get_footer_widgets();
    	
    	if ( !empty( $widgets ) && 0 !== $widgets ) : 
    	
    		// Set up the widget width
    		$widget_width = '';
    		if ( $widgets == 1 ) $widget_width = '100';
    		if ( $widgets == 2 ) $widget_width = '50';
    		if ( $widgets == 3 ) $widget_width = '33';
    		if ( $widgets == 4 ) $widget_width = '25';
    		if ( $widgets == 5 ) $widget_width = '20';
    		?>
    		<div id="footer-widgets" class="site footer-widgets">
    			<div <?php generate_inside_footer_class(); ?>>
    				<div class="inside-footer-widgets">
    					<?php if ( $widgets >= 1 ) : ?>
    						<div class="footer-widget-1 grid-parent grid-<?php echo absint( apply_filters( 'generate_footer_widget_1_width', $widget_width ) ); ?> tablet-grid-<?php echo absint( apply_filters( 'generate_footer_widget_1_tablet_width', '50' ) ); ?> mobile-grid-100">
    							<?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('footer-1')): ?>
    								<aside class="widget inner-padding widget_text">
    									<h4 class="widget-title"><?php _e('Footer Widget 1','generatepress');?></h4>			
    									<div class="textwidget">
    										<p><?php printf( __( 'Replace this widget content by going to <a href="%1$s"><strong>Appearance / Widgets</strong></a> and dragging widgets into this widget area.','generatepress' ), esc_url( admin_url( 'widgets.php' ) ) ); ?></p>
    										<p><?php printf( __( 'To remove or choose the number of footer widgets, go to <a href="%1$s"><strong>Appearance / Customize / Layout / Footer Widgets</strong></a>.','generatepress' ), esc_url( admin_url( 'customize.php' ) ) ); ?></p>
    									</div>
    								</aside>
    							<?php endif; ?>
    						</div>
    					<?php endif;
    					
    					if ( $widgets >= 2 ) : ?>
    					<div class="footer-widget-2 grid-parent grid-<?php echo absint( apply_filters( 'generate_footer_widget_2_width', $widget_width ) ); ?> tablet-grid-<?php echo absint( apply_filters( 'generate_footer_widget_2_tablet_width', '50' ) ); ?> mobile-grid-100">
    						<?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('footer-2')): ?>
    							<aside class="widget inner-padding widget_text">
    								<h4 class="widget-title"><?php _e('Footer Widget 2','generatepress');?></h4>			
    								<div class="textwidget">
    									<p><?php printf( __( 'Replace this widget content by going to <a href="%1$s"><strong>Appearance / Widgets</strong></a> and dragging widgets into this widget area.','generatepress' ), esc_url( admin_url( 'widgets.php' ) ) ); ?></p>
    									<p><?php printf( __( 'To remove or choose the number of footer widgets, go to <a href="%1$s"><strong>Appearance / Customize / Layout / Footer Widgets</strong></a>.','generatepress' ), esc_url( admin_url( 'customize.php' ) ) ); ?></p>
    								</div>
    							</aside>
    						<?php endif; ?>
    					</div>
    					<?php endif;
    					
    					if ( $widgets >= 3 ) : ?>
    					<div class="footer-widget-3 grid-parent grid-<?php echo absint( apply_filters( 'generate_footer_widget_3_width', $widget_width ) ); ?> tablet-grid-<?php echo absint( apply_filters( 'generate_footer_widget_3_tablet_width', '50' ) ); ?> mobile-grid-100">
    						<?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('footer-3')): ?>
    							<aside class="widget inner-padding widget_text">
    								<h4 class="widget-title"><?php _e('Footer Widget 3','generatepress');?></h4>			
    								<div class="textwidget">
    									<p><?php printf( __( 'Replace this widget content by going to <a href="%1$s"><strong>Appearance / Widgets</strong></a> and dragging widgets into this widget area.','generatepress' ), esc_url( admin_url( 'widgets.php' ) ) ); ?></p>
    									<p><?php printf( __( 'To remove or choose the number of footer widgets, go to <a href="%1$s"><strong>Appearance / Customize / Layout / Footer Widgets</strong></a>.','generatepress' ), esc_url( admin_url( 'customize.php' ) ) ); ?></p>
    								</div>
    							</aside>
    						<?php endif; ?>
    					</div>
    					<?php endif;
    					
    					if ( $widgets >= 4 ) : ?>
    					<div class="footer-widget-4 grid-parent grid-<?php echo absint( apply_filters( 'generate_footer_widget_4_width', $widget_width ) ); ?> tablet-grid-<?php echo absint( apply_filters( 'generate_footer_widget_4_tablet_width', '50' ) ); ?> mobile-grid-100">
    						<?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('footer-4')): ?>
    							<aside class="widget inner-padding widget_text">
    								<h4 class="widget-title"><?php _e('Footer Widget 4','generatepress');?></h4>			
    								<div class="textwidget">
    									<p><?php printf( __( 'Replace this widget content by going to <a href="%1$s"><strong>Appearance / Widgets</strong></a> and dragging widgets into this widget area.','generatepress' ), esc_url( admin_url( 'widgets.php' ) ) ); ?></p>
    									<p><?php printf( __( 'To remove or choose the number of footer widgets, go to <a href="%1$s"><strong>Appearance / Customize / Layout / Footer Widgets</strong></a>.','generatepress' ), esc_url( admin_url( 'customize.php' ) ) ); ?></p>
    								</div>
    							</aside>
    						<?php endif; ?>
    					</div>
    					<?php endif;
    					
    					if ( $widgets >= 5 ) : ?>
    					<div class="footer-widget-5 grid-parent grid-<?php echo absint( apply_filters( 'generate_footer_widget_5_width', $widget_width ) ); ?> tablet-grid-<?php echo absint( apply_filters( 'generate_footer_widget_5_tablet_width', '50' ) ); ?> mobile-grid-100">
    						<?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('footer-5')): ?>
    							<aside class="widget inner-padding widget_text">
    								<h4 class="widget-title"><?php _e('Footer Widget 5','generatepress');?></h4>			
    								<div class="textwidget">
    									<p><?php printf( __( 'Replace this widget content by going to <a href="%1$s"><strong>Appearance / Widgets</strong></a> and dragging widgets into this widget area.','generatepress' ), esc_url( admin_url( 'widgets.php' ) ) ); ?></p>
    									<p><?php printf( __( 'To remove or choose the number of footer widgets, go to <a href="%1$s"><strong>Appearance / Customize / Layout / Footer Widgets</strong></a>.','generatepress' ), esc_url( admin_url( 'customize.php' ) ) ); ?></p>
    								</div>
    							</aside>
    						<?php endif; ?>
    					</div>
    					<?php endif; ?>
    				</div>
    			</div>
    		</div>
    	<?php
    	endif;
    	do_action( 'generate_after_footer_widgets' );
    }
    endif; 
    #268888
    Pete

    I got it right πŸ™‚ I’m gonna have a huge functions.php file! πŸ˜‰

    #268889
    Pete

    How would I go about compartmentalising my functions.php into sub-function files that I include into the main functions.php file?

    #268890
    Pete
    #268892
    Tom
    Lead Developer
    Lead Developer

    Yep that’s the way to go.

    Putting them into a function allows us to move/remove the element without overwriting the whole file. It’s the right way to go.

    Nothing is stopping you from removing the hook from your footer.php file and adding the code back in there, you just need to add that new container to make the spacing work.

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.