Show only Generate Box and Footer widgets on Homepage

Community Forums Forums Design Tips and Tricks Show only Generate Box and Footer widgets on Homepage

This topic is: resolved

Tagged: 

This topic contains 6 replies, has 4 voices, and was last updated by  derekalvarez 1 year, 6 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #18493

    Antonios
    Participant
    Post count: 10

    I would like my home page to show only the generate box and the three column footer widgets .  In the wordpress settings I have to choose to show blog or static page on the home page.  Is there a way around this? Seee my site at http://2mmpartners.com

    here is the code in my front-page.php

    <?php

    /** Add Generate Box after header **/
    add_action( ‘genesis_after_header’, ‘generate_box’, 10 );
    function generate_box() {

    if ( is_active_sidebar( ‘generate-box’ ) ) {
    echo ‘<div id=”generate-box”><div class=”wrap”>’;
    dynamic_sidebar( ‘generate-box’ );
    echo ‘</div><!– end .wrap –></div><!– end #generate-box –>’;
    }

    }

    genesis();


    • This topic was modified 1 year, 6 months ago by  Antonios. Reason: clarify code block
    • This topic was modified 1 year, 6 months ago by  Antonios. Reason: clarify code block
    #18597

    braddalton
    Participant
    Post count: 9396

    An easy way to do this would be to install the Widget Logic plugin and add is_home() to the widget logic field which is added to all widgets.

    Don’t forget you also have Generate Box plugin settings like this:

    Display Settings > Enable and display Generate Box > Enable Generate Box on front page?


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #18836

    Antonios
    Participant
    Post count: 10

    Thanks for the response but the Generate box is fine the way it is.  I’m trying to remove the front page requirement so that the only thing that shows up is the generate box and footer widgets.  right now there is a page in the middle of these items that is displaying.


    #18876

    braddalton
    Participant
    Post count: 9396

    Many ways to do this. Using CSS and display:none is the easy way but its not best practice:
    [css]
    .home #content{
    display: none;
    }
    [/css]

    Here i added the generate box using php to a copy of the landing page template using a conditional tag and editing the different elements which are filtered out using the default remove action for the landing page:

    [php]
    /** Add Generate Box after header **/
    add_action( ‘genesis_after_header’, ‘generate_box’, 10 );
    function generate_box() {

    if ( is_page( ’37533′ ) ) {
    echo ‘<div id="generate-box"><div class="wrap">’;
    dynamic_sidebar( ‘generate-box’ );
    echo ‘</div><!– end .wrap –></div><!– end #generate-box –>’;
    }

    }

    // Remove header, navigation, breadcrumbs, footer widgets, footer
    add_filter( ‘genesis_pre_get_option_site_layout’, ‘__genesis_return_full_width_content’ );
    remove_action( ‘genesis_before_loop’, ‘genesis_do_breadcrumbs’);

    genesis();
    [/php]

    [css]
    .page-id-37533 #content{
    display: none;
    }
    [/css]

    Creating a custom home.php or custom page template is better than using CSS to hide content.


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #18917

    Hard Boiled Greg
    Participant
    Post count: 88

    Hi,

    I’m not sure about what you are doing with the front-page.php as the Generate theme doesn’t have that file “out-of-the-box”

    To accomplish what you are after with a default install, you would open home.php and delete:

    [php]add_action( ‘genesis_loop’, ‘child_grid_loop_helper’ );
    /** Add support for Genesis Grid Loop **/
    function child_grid_loop_helper() {

    if ( function_exists( ‘genesis_grid_loop’ ) ) {
    remove_action( ‘genesis_before_post_content’, ‘generate_post_image’, 5 );
    genesis_grid_loop( array(
    ‘features’ => 2,
    ‘feature_image_size’ => ‘featured’,
    ‘feature_image_class’ => ‘alignleft post-image’,
    ‘feature_content_limit’ => 0,
    ‘grid_image_size’ => ‘grid’,
    ‘grid_image_class’ => ‘alignleft post-image’,
    ‘grid_content_limit’ => 0,
    ‘more’ => __( ‘Continue reading…’, ‘genesis’ ),
    ‘posts_per_page’ => 6,
    ) );
    } else {
    genesis_standard_loop();
    }

    }[/php]

    And then add:

    [css].home #inner {
    display: none;
    }[/css]

    to your CSS file to remove the empty div

    Again, this is how to do it without your custom front-page.php file.

    Let me know how you make out.

    Hard Boiled Greg


    Website: Hard Boiled Greg Twitter: @hbgreg

    #19158

    Antonios
    Participant
    Post count: 10

    thanks Greg, that’s what I was looking for.


    #22029

    derekalvarez
    Participant
    Post count: 47

    Hi Greg, what about if I want to remove the blog posts and sidebar from the home page, and instead add a full-width widget? I used this tutorial to add a home page widget…

    http://my.studiopress.com/tutorials/register-widget-area/

    …but I’m struggling with what code I should add to the home.php file.

    Website url is…

    http://tucsoncarservice.net/

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

You must be logged in to reply to this topic.