Community Forums › Forums › Archived Forums › Design Tips and Tricks › How to Remove Footer from Home Page in Metric Theme
Tagged: php, remove footer widgets
- This topic has 14 replies, 4 voices, and was last updated 10 years, 9 months ago by
Bill Murray.
-
AuthorPosts
-
December 29, 2012 at 4:14 pm #8218
harooki2
MemberI need to remove the footer (all four widgets) from my home page in the Metric theme. Can someone point me to a post or offer advice?
December 29, 2012 at 4:39 pm #8221Brian Bourn
MemberAdd this to your theme's home.php file near the end but above "genesis();"
remove_action( 'genesis_before_footer', 'genesis_footer_widget_areas' );
Bourn Creative | bourncreative.com | Twitter
December 29, 2012 at 4:55 pm #8228harooki2
MemberI can't find genesis(); anywhere in that file, so I don't know where to put it. It doesn't work putting it at the very bottom, but that's all I've tried.
December 29, 2012 at 5:06 pm #8233Bill Murray
Member@Brian - The Metric home page is controlled by home.php, which is for practical purposes, HTML. Therefore, PHP has to be enclosed with start & end tags.
@harooki2 - Try putting the line below after <?php genesis_home(); ?>, which should be line 2.<?php remove_action( 'genesis_before_footer', 'genesis_footer_widget_areas' ); ?>
Web: https://wpperform.com or Twitter: @wpperform
We do managed WordPress hosting.
December 29, 2012 at 5:13 pm #8234harooki2
MemberWell, that didn't work either. Wish I knew PHP :), I could save you guys a lot of time.
December 29, 2012 at 8:01 pm #8271Bill Murray
MemberOk, it's a little different on Metric because of the way footer widgets are added. Try adding this to your home.php:
Web: https://wpperform.com or Twitter: @wpperform
We do managed WordPress hosting.
December 30, 2012 at 10:10 am #8378harooki2
MemberBill, I don't see any code in your last message.
December 30, 2012 at 10:14 am #8380Bill Murray
MemberOdd. The forum stripped that out. Here it is:
<?php remove_action('genesis_before_footer', 'metric_include_footer_widgets'); ?>
I tested that on my own Metric install, and it works.
One note on this: Genesis child themes can make changes to where certain functions are called or named. When you want to make changes or follow a tip from these forums, it's a good idea to see if your child theme's functions.php is having an effect on the thing you want to change. Even if you don't understand PHP, if you want to change footers and see some code with 'footer' in it in your functions.php, that's a good hint that your fix has to take that into account.
Web: https://wpperform.com or Twitter: @wpperform
We do managed WordPress hosting.
December 30, 2012 at 10:27 am #8382harooki2
MemberThis didn't work for me, either. I tested the code in my home.php at line 1, line 2, line 3, the line before the last line, and the last line. I cleared my cache before refreshing the page each time. I copied it exactly as you have it in your last message, including the beginning and ending tags.
December 30, 2012 at 11:17 am #8391Riavon
MemberThe Genesis gurus advise making changes to the functions.php file, rather than the home.php
From the old forums, andrea_r suggests: "You can remove that widget area entirely by removing the declaration for it from the functions.php file. Look for the code that says footer-widgets and remove it."
SoZo instructs: "Delete this from functions.php:
// Add widgeted footer section add_action('genesis_before_footer', 'metric_include_footer_widgets'); function metric_include_footer_widgets() { require(CHILD_DIR.'/footer-widgeted.php'); }
And Nick suggests:
"Open the functions.php file and find where it has the action to add the footer widgets, and put a // in front of the add_action() line.
Find this:
// Add widgeted footer section add_action('genesis_before_footer', 'metric_include_footer_widgets'); function metric_include_footer_widgets() { require(CHILD_DIR.'/footer-widgeted.php'); }
Change it to this:
// Add widgeted footer section //add_action('genesis_before_footer', 'metric_include_footer_widgets'); function metric_include_footer_widgets() { require(CHILD_DIR.'/footer-widgeted.php'); }
Hope this helps you.
Twitter: @riavonentprises
December 30, 2012 at 11:55 am #8393Bill Murray
Member@riavon - Based on what the original poster asked for, that's not good advice. The code you included will remove the footer from all pages. He said he only wants to remove it from his home page. There's nothing wrong or inefficient about modifying a child theme's home.php to effect changes on the home page. In fact, for home page changes, it's more logical to make changes to home.php if the child theme already includes that template.
If you found a statement to the contrary on the old forums, please post a link. I suspect the statement was intended to apply to a specific question and wasn't a hard-and-fast general rule. The statements you quoted above were likely in response to a request that was different from the original poster's request.
Web: https://wpperform.com or Twitter: @wpperform
We do managed WordPress hosting.
December 30, 2012 at 12:00 pm #8395Riavon
MemberWhoopsie. In my zealous desire to help, I overlooked that he says home page. My very deepest apologies to you Bill as well as to you harooki2. I am sure with all the expertise and highly knowledgeable participants on this forum, you will most assuredly find the answer you need. Good day, and good bye.
Twitter: @riavonentprises
December 30, 2012 at 12:22 pm #8405Bill Murray
MemberNo apology necessary. "Good bye" sounds so final. I hope you weren't put off by my comments, because I didn't intend that. I'm sorry if it came across as harsh. Harooki2 has had a couple of threads on changing his home page, and code that Brian and I had given him previously didn't work, so I just wanted him to avoid going down a path that might cause him further frustration.
If you stick around long enough, you'll have plenty of good opportunities to tell me my advice is terrible 🙂
Web: https://wpperform.com or Twitter: @wpperform
We do managed WordPress hosting.
December 30, 2012 at 1:25 pm #8429Riavon
MemberThanks, Bill. I get frustrated when I don't pay close enough attention. I do feel I owe an apology, since the advice I offered (though copied) wasn't what he was asking for. Perhaps I can redeem myself. Will this help?
From 3200 Creative. They say:
"Add this block of code to your functions.php file:
add_action( 'genesis_before', 'child_conditional_actions' ); function child_conditional_actions() { if( is_home() ) remove_action( 'genesis_before_footer', 'genesis_footer_widget_areas' ); }
I've customized the appearance of home pages via home.php several times... adding/deleting widgets, etc. and I learned how to do it only by Googling tutorials, and of course, lots of trial and error. Sometimes we need to become amateur php coders (or at least copy/pasters) to get the results we want.
Hopefully the tutorial link above puts harooki2 on the right path. Although, on an additional read-through of the thread, it appears that you (Bill) had already suggested the if(is_home() ) bit. I will gracefully bow out of this one, LOL! My strength is CSS, so probably will focus on helping with CSS issues.
Twitter: @riavonentprises
December 30, 2012 at 4:00 pm #8447Bill Murray
MemberDon't bow out. The more contributions, the better. We all learned by starting with no knowledge, so any effort to help point people in the right direction is a good approach. If the advice you give isn't quite right, there are plenty of troublemakers to tell you where you went wrong. Just be sure to give it right back at them.
Your latest block of code isn't quite right. It is a way to add that to functions.php because it uses the is_home() conditional. But the remove action is wrong, because that's not how Metric adds its footer widgets. Metric is an older theme that adds footer widgets by an included script. That's why I said in an earlier post to always look at the functions.php to see what the child theme is modifying by default. So in your code, replace genesis_footer_widget_areas with metric_include_footer_widgets and it should work in functions.php. For newer themes, as a general guideline your code would probably work without modification, but each child theme could change things in its own functions.php.
Web: https://wpperform.com or Twitter: @wpperform
We do managed WordPress hosting.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.