- This topic has 13 replies, 6 voices, and was last updated 4 years, 6 months ago by Tom.
-
AuthorPosts
-
January 5, 2015 at 5:22 am #61763Roy Shimmyo
Is it possible to change the widths of each individual footer widget? Our design team has proposed a design where the middle widget is approximately twice the width of the other two widgets. Is this possible?
January 5, 2015 at 3:42 pm #61970TomLead DeveloperLead DeveloperIt’s possible, but not super easy as of right now.
I want to make it easier in a near-future update, but it’s not quite there yet.
What you can do is this:
Create a child theme – or use this one: http://generatepress.com/api/themes/generatepress_child.zip
Now, copy the footer.php file from the “generatepress” folder, and add it to your child theme folder (generatepress_child).
Now GP is using the file in your child theme’s folder.
Now you’ll see 5 different elements that start like this:
<div class="footer-widget-1 grid-parent grid-<?php echo $widget_width; ?>">
They will each be named “footer-widget-1”, “footer-widget-2” and so on.
Now, doing this will make it so choosing the widget width in the Customizer doesn’t work anymore, but that’s ok as a future update will include this functionality, and you’ll be able to delete the footer.php file from your child theme, and start using the new feature.
So the important part of each element is this:
grid-<?php echo $widget_width; ?>
You want to replace
<?php echo $widget_width; ?>
with the width of that widget as a percentage.So if we want “footer-widget-1” to be 25% wide, we would now have this:
<div class="footer-widget-1 grid-parent grid-25">
And if we want footer-widget-2 to be 40% wide, we do this:
<div class="footer-widget-1 grid-parent grid-40">
Not easy, but it’s do-able!
Hope this is helpful π
January 6, 2015 at 5:46 am #62069Roy ShimmyoThank you. This is very helpful. I do have a question regarding the values for the widths. Should they add up to 100, or some other number less than 100?
January 6, 2015 at 10:08 am #62219TomLead DeveloperLead DeveloperYes, ideally they should add up to 100 π
Glad it was helpful!
July 24, 2017 at 2:26 am #353898PatrickHi Tom,
meanwhile, is there an easier solution for this issue? π
Please let me know.
Thanks,
PatJuly 24, 2017 at 8:54 am #354087LeoStaffCustomer SupportHi Patrick,
This should help: https://docs.generatepress.com/article/footer-widgets/#choosing-different-widths-for-each-widget-area
March 26, 2020 at 6:42 am #1210611fabiosilvaHi, Leo
Using this filters (or similar), any way to set separately the size of tablet and mobile grid witdh?
Thank you
March 26, 2020 at 7:23 am #1210650DavidStaffCustomer SupportHi there,
there is a separate filter for tablets:
March 26, 2020 at 7:28 am #1210654fabiosilvaNice, David!
Thank you.March 26, 2020 at 7:28 am #1210658DavidStaffCustomer SupportGlad we could be of help
March 26, 2020 at 8:17 am #1210873fabiosilvaBtw, David
I’ve tried make something similar to this (on tablet view):
add_filter( 'generate_footer_widget_1_tablet_width', function() { return '100'; } ); add_filter( 'generate_footer_widget_2_tablet_width', function() { return '33'; } ); add_filter( 'generate_footer_widget_3_tablet_width', function() { return '33'; } ); add_filter( 'generate_footer_widget_4_tablet_width', function() { return '33'; } ); add_filter( 'generate_footer_widget_5_tablet_width', function() { return '100'; } );
But the 2, 3 and 4 column dont stay in the same line. Do you know if this is possible?
ThanksMarch 26, 2020 at 5:59 pm #1211358TomLead DeveloperLead DeveloperHi there,
Any chance you can link us to your site? This isn’t how the filter was meant to work, so we likely need to give you a bit of CSS to get it working right π
March 27, 2020 at 2:09 am #1211584fabiosilvaHi, Tom!
You can see my website link in this topic:
https://generatepress.com/forums/topic/header-mobile-search-close-button-centeres-header-on-tablet/I tried some CSS options before coming here. But I didn’t find a way.
Thank you
March 27, 2020 at 9:24 am #1212197TomLead DeveloperLead DeveloperGive this a shot:
@media (max-width: 1024px) and (min-width: 768px) { .inside-footer-widgets { display: flex; flex-wrap: wrap; } .tablet-grid-33 { width: 33.333%; } }
-
AuthorPosts
- You must be logged in to reply to this topic.