[Theme: Twenty Twelve] Footer Widgets
-
How can I add footer bars so that I can add widgets in them?
-
You might want to check out the implementation in
/page-templates/front-page.php
. On line 34 it calls a sidebar, right before getting the footer content. You could add such a call first thing infooter.php
, to only have one place to maintain.Konstantin
I struggled with this for a while. Copying
<?php get_sidebar( 'front' ); ?>
into footer.php isn’t the complete solution, because the footer widgets will be treated like the main sidebar widgets by the css, and therefore be floated to the right. What I found out after inspecting the css is that you need to apply the classes “template-front-page” and “two-sidebars”. This is the code that is needed in footer.php:<footer class="template-front-page two-sidebars"> <?php get_sidebar( 'front' ); ?> </footer>
I replaced the whole existing footer element (with id “colophon”) with this code. This way, the widgets you put in “First Front Page Widget Area” and “Second Front Page Widget Area” will be included in the footer on every page (these widget area names can be changed on lines 207 and 217 in functions.php). Hope this can be of help to somebody!
Worked for me by just putting in the last code only in the post above Lance’s last one. What if you really need 3 front-page sidebars to keep your footer area from being to much in height?
Create a child theme first.
Add this to functions.php (registers the footer widgets)
https://pastebin.com/KjtwGHUvIn footer.php add this under the line
<footer id="colophon" role="contentinfo">
https://pastebin.com/Ntq8yEFRAdd this to style.css
https://pastebin.com/jQHRzr8RNow you have 3 footer widget areas
My free child theme has footer widgets and a few extras if you want to use that https://zeaks.org/general/twenty-plus-lite-twenty-twelve-child-theme/
I have a child theme using the default template. I read a post where it was stated that you can’t have footer widgets unless you used the front-page template. Am I understanding that correctly? Also, do you add register footer widgets in footer.php in the primary twenty twelve theme or do you copy the footer.php into the child theme directory and edit it? If child theme, would you remove every code and then place this code into the child theme footer.php? Same question with the second line of code in your comment above this one? Also, would I place the footer background color code into the child theme css or to the primary theme footer.php? My site is at https://roundhousetalk.com.
You would copy the templates to your child theme folder and edit those.
Don’t remove any of the code already in it, add the code posted above to it where it says.
You’ll need to create a functions.php file yourself, make sure to add an opening php tag
<?php
at the top before adding the code.Add any CSS to the child theme style.css
Do you just add the https://zeaks.org/general/twenty-plus-lite-twenty-twelve-child-theme/ contents straight into the child theme or do you copy the folder and it’s content stratight into the child theme and leave the files inside the folder? My directory is /themes/twentytwelve-child/ so afterwards it would be /twentytwelve-child/twenty-plus-lite/ ?
Also, if I create a footer.php myself, what will it look look like before I do anything? Will it be blank and then after editing it will only have the code above from your first comment in this thread? I’m still new and learning.
If you’re installing that child theme you linked, just install it like any other theme, then visit Appearance > theme Options and configure it how you want and add your widgets the same as you would any theme in Appearance > Widgets
If you’re creating the footer yourself (copying it from Twenty Twelve to your child theme) it will look exactly like Twenty Twelves until you make changes to it. Don’t remove any code from it, just add the code as I said in the comment above.
Ok, I added the additional code to the identified scripts identified above but from your instructions above. Nothing changed and I still have 2 front page widget areas and one I had to put 3 menus in it previously. What should happen when I insert the code into footer.php; functions.php; and style.css? I went into Appearance and Editor and set the theme to your child theme also.
These widgets won’t display on the homepage template, it already has 2. If you’re using my child theme then you don’t have to do any of that. Just visit Appearance > widgets, set up your widgets and that’s it. If you’re using the front page template, as your homepage then you won’t see them on the front page.
Zeaks, do you mean the front-page template? My static page is named “Home” using the default template. Any thoughts?
I mean the homepage template, it’s a special page template that comes with Twenty Eleven that already contains 2 footer widgets.
Link your site, I don’t know if you’re using the theme I linked or if you’re adding this to your own child theme, or if you’ve added it to the theme I linked.
Ok. It is https://roundhousetalk.com. I do want the footer to appear on every page. Thanks.
- The topic ‘[Theme: Twenty Twelve] Footer Widgets’ is closed to new replies.