Community Forums › Forums › Archived Forums › Design Tips and Tricks › Focus-widget to appear on homepage only
Tagged: focus homepage layout
- This topic has 8 replies, 3 voices, and was last updated 10 years, 2 months ago by
professorz.
-
AuthorPosts
-
March 31, 2013 at 9:11 am #32255
professorz
MemberHi all,
I have added and registered a featured bottom widget that I want to display below the main content area on the homepage of a site built on the focus theme. I only want it to display on the home page and it is displaying on all pages.
The home.php file for focus is thrwoing me for a loop, pun intended, because it is different than any child theme I have worked in so far. It doesn't have the usual code where you specify what you want to display just on the home page - instead it only has language for the Genesis grid loop.
Does anyone know how I can get a widget area to ONLY display on the home page in the focus theme?
Thanks very much!
March 31, 2013 at 9:20 am #32257nciske
MemberUse widget logic:
http://wordpress.org/extend/plugins/widget-logic/Or...
Hide the widget with CSS on all pages except home and show it only on the home page.
Nick Ciske | https://luminfire.com/ | @nciske
Did I help you? Say thanks: http://bit.ly/1lahwy0March 31, 2013 at 9:35 am #32261professorz
MemberThanks so much for the prompt reply and great suggestion!
I'm going to try this as soon as I get back from Easter dinner.
Would you mind leaving this request open in case I need any additional assistance with this?
March 31, 2013 at 10:03 am #32268Brad Dalton
ParticipantBetter to add the widget code to your functions.php file than the home.php template.
What code did you use to add the widget? You can easily add a conditional tag to the code and avoid installing another plugin and editing your template files.
What hook location are you using for the widget?
Here's the code that can be easily modified using another hook
https://gist.github.com/5257550
March 31, 2013 at 2:41 pm #32327professorz
MemberHi Brad,
With Focus, I saw no place to add any code for widgets in the home.php file, so the 2 following bits of code were added to the functions.php file:
/** Add the featured bottom section */
add_action( 'genesis_after_post_content', 'custom_featured_bottom_text' );
function custom_featured_bottom_text() {
genesis_widget_area( 'featured-bottom', array(
'before' => '<div class="featured-bottom widget-area">',
) );
}- AND -
/** Register widget areas */
genesis_register_sidebar( array(
'id' => 'featured-bottom',
'name' => __( 'Featured Bottom', 'genesis' ),
'description' => __( 'This is the featured bottom section of the homepage.', 'focus' ),
) );The widget is now showing below the main content on every page; trying to just get it to dsiplay on the home page.
Are you saying I should add the Hook to my Home Page Only language somewhere in one of the above codes in the functions.php file?
And, thank you ver much for replying.
April 1, 2013 at 2:09 am #32397Brad Dalton
ParticipantCan you link to your site please.
Are you using full width on front page?
Are you displaying posts on the home page or using a static page for the front page?
The code will be different for each.
Which hook location do you want to use?
More code on Github https://gist.github.com/5283769
April 1, 2013 at 6:49 am #32413professorz
MemberG'Day Brad,
Theme is set to sidebar/content for the home page and entire site.
Using a static page for the home page.
Currently telling featured bottom widget to display genesis_after_post_content - which it is - except on all pages.
It appears I may want to be using after_content_home instead?
Definitely only want this widget on the home page below the static page content and only content width, not after content sidebar wrap.
Present URL is:
http://virtualassistantwebdesign.com/betaL1/
Thanks so much for your help!
April 1, 2013 at 8:33 am #32427Brad Dalton
ParticipantThe code i embedded above works on the home page.
There is no after_content_home hook
Please use that code and change the hook if needed.
April 1, 2013 at 11:01 am #32468professorz
Member@nciske and @braddalton
Thank you both very much for your time and suggestions.
A combination of both resolved my issue and the widget is now only appearing on the home page =)
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.