- This topic has 8 replies, 2 voices, and was last updated 7 years, 2 months ago by Tom.
-
AuthorPosts
-
January 25, 2017 at 6:01 am #268346Pete
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
January 25, 2017 at 9:05 am #268464TomLead DeveloperLead DeveloperAre 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.
January 25, 2017 at 7:41 pm #268820PeteYep I’ll take a look at it and try to update it with my stuff
January 25, 2017 at 10:44 pm #268858TomLead DeveloperLead DeveloperSounds good π
January 26, 2017 at 12:03 am #268887PeteHi 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;
January 26, 2017 at 12:08 am #268888PeteI got it right π I’m gonna have a huge functions.php file! π
January 26, 2017 at 12:09 am #268889PeteHow would I go about compartmentalising my functions.php into sub-function files that I include into the main functions.php file?
January 26, 2017 at 12:11 am #268890PeteJanuary 26, 2017 at 12:16 am #268892TomLead DeveloperLead DeveloperYep 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.
-
AuthorPosts
- You must be logged in to reply to this topic.