Widgets in footer?
-
Hi,
is it possible to add some widgets to the footer section in theme author? Something like creating a footer template and add that to the footer? I’m currently working with elementor to design my site.
Or something like adding shortcode to the footer, or alter the footer.php file?thanks again,
Bert.
-
If you’ve got Elementor Pro then creating a custom footer that way will be really easy and flexible.
To get it working with Author, copy the footer.php file into your child theme. Then wrap the entire
<footer>
element with this if statement:// Elementor footer location if ( ! function_exists( 'elementor_theme_do_location' ) || ! elementor_theme_do_location( 'footer' ) ) : ?> <footer> There's a few lines of code here in the real file. </footer> <?php endif; ?>
I will be adding support for Elementor footers into Author in an upcoming update – it will be implemented exactly like this.
If you’re not using Elementor Pro for custom footers let me know. It will be more work to add widget support or hard-code something into the footer.php file, but still possible.
- This reply was modified 4 years, 8 months ago by Ben Sibley.
I’m not using elementor pro, but could the plugin ‘header, footer & block’ possibly be a solution? If not, I’m familiar with coding (html, css, php).
Again, thanks for the quick respons, I realy apreaciate it as I do your theme! Hope to hear from you for further ideas.I’ve been playing around with the plugin I mentioned in my previous post,and I think this could offer a solution. I made a footer template and when you save it, it gives you a shortcode. I copied the footer.php into my child theme and added a php line with do_shortcode. This does display the template on the page, but leaves out the complete design-credit part of the original footer.
I put the code directly below the line do_action( ‘footer-top’ ). Probabely not the right place to put it. Can you tell me where to put the shortcode?
Another thing I noticed and haven’t been able to figure out: I changed the background color for the sidebar (to get a uniform background color over the entire page). Works fine on laptop and mobile version, but doesn’t work on tablet. There it slides in from the left, but keeps it dark original color, no matter what I try. Can you tell me how to change that background-color as well?Thanks in advance,
Bert.I would recommend placing your shortcode right below the opening
<footer>
tag. I can’t say exactly why the design credit is missing without getting a look at the site.This CSS should work for the sidebar background color at all screen sizes:
.main-sidebar { background: red; } @media all and (max-width: 950px) { body { background: red; } }
It sounds like you might already have the first bit, in which case you can just copy the media query part into your stylesheet.
The CSS does work indeed. Thanks for that. I did place the shortcode right below the opening <footer> tag, as you suggested, but this makes no difference. The site I’m working on is under development on localhost, so can’t add a URL for you to take a look. Would it help if I post a part of the code that is generated?
If not I will try to put the design credit in the footer template. Such great support for a free theme deserves credit in my oppinion!
Thanks again so far!
Thank you ??
Do you have debugging turned on? If nothing is being output after your code, I think there might actually be a PHP error that is preventing the last lines of the footer.php file from running. In the wp-config.php file inside the root folder of your WordPress install, you’ll find the WP_DEBUG constant set to “false” which you can switch to “true” and then you will see any error messages the site is outputting.
Make sure you have both opening and closing tags around your shortcode function, like this:
<footer> <?php echo do_shortcode('[example]'); ?>
And check for any other syntax errors or out-of-place characters.
WP_DEBUG is set to ‘true’, but I get no error messages. Could it be something the plugin does?
Hmm okay it could be the way the new content is styled. Maybe it is overlapping the design credit for some reason. Try adding one of these snippets to see if you can force the design credit to show up.
This will add a lot of spacing around it which might provide a clue for what’s happening:
.design-credit { margin: 80px 0; }
This will place it above any other content in case it’s being covered up:
.design-credit { position: absolute; bottom: 0; width: 100%; z-index: 99; }
I tried both your suggestions, but with the same outcome: no effect. Seems like the template created by the plugin (header, footer & block) is much more gressive. Especially since your second suggenstion should place the credits on top of the rest of the footer template. As if it ends the page somehow and discards anything that comes after it. If that is at all possible.
Meanwhile I have been able to make a workaround in case there is no other way to tackle this. I can add a row below the widgets in the footer in which I can place html code. only downside (in my opinion) is that the credits will be hard-coded and you will lose the filters and such which are present in the themes original foorter.php
I use firefox developer edition to see what goes on. I noticed that in the page code there is no <footer> tag nor </footer> tag. Only a <div class=”footer-width-fixer”>. This is the container div of the plugins footer template. Does this make any sense to you?
Thanks again for your input!
Since the code afterward is discarded, I was thinking that there must be an error stopping further output, but it sounds like footer.php must be getting replaced entirely if the
<footer>
element isn’t being included. This is essentially how Elementor works when a theme doesn’t explicitly include support for custom headers and footers, so it makes sense that the plugin you’re using would function the same way.In this case, I think you’ll have to hard-code the text into the footer using the plugin. That’s not a best practice but it’s not really a big deal in this context because the text is not going to be dynamic or require changing often.
- This reply was modified 4 years, 8 months ago by Ben Sibley.
Ok, thank you very much for all the help with this. I’ll hard-code a credits line in the footer. I’ll send you a link once the site is live.
Great, happy to help ??
- The topic ‘Widgets in footer?’ is closed to new replies.