Focus-widget to appear on homepage only

Community Forums Forums Design Tips and Tricks Focus-widget to appear on homepage only

This topic is: not resolved

This topic contains 8 replies, has 3 voices, and was last updated by  professorz 1 year, 6 months ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #32255

    professorz
    Participant
    Post count: 7

    Hi 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!

     

     

    #32257

    nciske
    Participant
    Post count: 55

    Use 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 | http://thoughtrefinery.com/ | @nciske
    Did I help you? Say thanks: http://bit.ly/1lahwy0

    #32261

    professorz
    Participant
    Post count: 7

    Thanks 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?

    #32268

    braddalton
    Participant
    Post count: 10177

    Better 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


    #32327

    professorz
    Participant
    Post count: 7

    Hi 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.

    #32397

    braddalton
    Participant
    Post count: 10177

    Can 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


    #32413

    professorz
    Participant
    Post count: 7

    G’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!

     

     

     

    #32427

    braddalton
    Participant
    Post count: 10177

    The 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.


    #32468

    professorz
    Participant
    Post count: 7

    @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 =)

     

     

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.