home.php like News for Decor theme

Community Forums Forums Design Tips and Tricks home.php like News for Decor theme

This topic is: not resolved

This topic contains 5 replies, has 4 voices, and was last updated by  scoe 1 year, 7 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #7666

    maui
    Participant
    Post count: 22

    Hi,

    I prefer flexible homepage of News theme and would like to have it for Decor theme.  I copied home.php of News theme and replaced news by decor:

    home.php

    <?php

    add_action( 'genesis_meta', 'decor_home_genesis_meta' );
    /**
    * Add widget support for homepage. If no widgets active, display the default loop.
    *
    */
    function decor_home_genesis_meta() {

    if ( is_active_sidebar( 'home-top' ) || is_active_sidebar( 'home-middle-left' ) || is_active_sidebar( 'home-middle-right' ) || is_active_sidebar( 'home-bottom' ) ) {

    remove_action( 'genesis_loop', 'genesis_do_loop' );
    add_action( 'genesis_loop', 'decor_home_loop_helper' );
    add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_content_sidebar' );
    add_filter( 'body_class', 'add_body_class' );
    function add_body_class( $classes ) {
    $classes[] = 'decor';
    return $classes;
    }

    }
    }

    function decor_home_loop_helper() {

    if ( is_active_sidebar( 'home-top' ) ) {

    echo '<div id="home-top"><div class="border wrap">';
    dynamic_sidebar( 'home-top' );
    echo '</div><!-- end .border wrap --></div><!-- end #home-top -->';

    }

    if ( is_active_sidebar( 'home-middle-left' ) || is_active_sidebar( 'home-middle-right' ) ) {

    echo '<div id="home-middle"><div class="border wrap">';

    echo '<div class="home-middle-left">';
    dynamic_sidebar( 'home-middle-left' );
    echo '</div><!-- end .home-middle-left -->';

    echo '<div class="home-middle-right">';
    dynamic_sidebar( 'home-middle-right' );
    echo '</div><!-- end .home-middle-right -->';

    echo '</div><!-- end .border wrap --></div><!-- end #home-middle -->';

    }

    if ( is_active_sidebar( 'home-bottom' ) ) {

    echo '<div id="home-bottom"><div class="border wrap">';
    dynamic_sidebar( 'home-bottom' );
    echo '</div><!-- end .border wrap --></div><!-- end #home-bottom -->';

    }

    }

    genesis();

    Now I understood to use functions.php of News theme? If so, do I have to replace all “news” tags by decor?


    <?php
    /** Start the engine */
    require_once( get_template_directory() . '/lib/init.php' );

    /** Child theme (do not remove) */
    define( 'CHILD_THEME_NAME', 'News Theme' );
    define( 'CHILD_THEME_URL', 'http://www.studiopress.com/themes/news' );

    /** Add Viewport meta tag for mobile browsers */
    add_action( 'genesis_meta', 'news_add_viewport_meta_tag' );
    function news_add_viewport_meta_tag() {
    echo '';
    }

    $content_width = apply_filters( 'content_width', 580, 430, 910 );

    /** Create additional color style options */
    add_theme_support( 'genesis-style-selector', array(
    'news-green' => 'Green',
    'news-orange' => 'Orange',
    'news-pink' => 'Pink',
    'news-purple' => 'Purple',
    'news-red' => 'Red',
    'news-teal' => 'Teal'
    ) );

    /** Add support for structural wraps */
    add_theme_support( 'genesis-structural-wraps', array(
    'header',
    'nav',
    'subnav',
    'inner',
    'footer-widgets',
    'footer'
    ) );

    /** Add new image sizes */
    add_image_size( 'home-bottom', 110, 110, TRUE );
    add_image_size( 'home-middle-left', 280, 165, TRUE );
    add_image_size( 'home-middle-right', 50, 50, TRUE );
    add_image_size( 'home-tabs', 150, 220, TRUE );

    /** Add support for custom header */
    add_theme_support( 'genesis-custom-header', array(
    'width' => 960,
    'height' => 110
    ) );

    /** Add support for custom background */
    add_theme_support( 'custom-background' );

    /** Reposition the secondary navigation */
    remove_action( 'genesis_after_header', 'genesis_do_subnav' );
    add_action( 'genesis_before', 'genesis_do_subnav' );

    /** Add after post ad section */
    add_action( 'genesis_after_post_content', 'news_after_post_ad', 9 );
    function news_after_post_ad() {
    if ( is_single() && is_active_sidebar( 'after-post-ad' ) ) {
    echo '';
    dynamic_sidebar( 'after-post-ad' );
    echo '';
    }
    }

    /** Add after content ad section */
    add_action( 'genesis_before_footer', 'news_after_content_ad' );
    function news_after_content_ad() {
    if ( is_active_sidebar( 'after-content-ad' ) ) {
    echo '';
    dynamic_sidebar( 'after-content-ad' );
    echo '';
    }
    }

    /** Add support for 3-column footer widgets */
    add_theme_support( 'genesis-footer-widgets', 3 );

    /** Register widget areas */
    genesis_register_sidebar( array(
    'id' => 'home-top',
    'name' => __( 'Home Top', 'news' ),
    'description' => __( 'This is the home top section.', 'news' ),
    ) );
    genesis_register_sidebar( array(
    'id' => 'home-middle-left',
    'name' => __( 'Home Middle Left', 'news' ),
    'description' => __( 'This is the home middle left section.', 'news' ),
    ) );
    genesis_register_sidebar( array(
    'id' => 'home-middle-right',
    'name' => __( 'Home Middle Right', 'news' ),
    'description' => __( 'This is the home middle right section.', 'news' ),
    ) );
    genesis_register_sidebar( array(
    'id' => 'home-bottom',
    'name' => __( 'Home Bottom', 'news' ),
    'description' => __( 'This is the home bottom section.', 'news' ),
    ) );
    genesis_register_sidebar( array(
    'id' => 'after-post-ad',
    'name' => __( 'After Post Ad', 'news' ),
    'description' => __( 'This is the after post ad section.', 'news' ),
    ) );
    genesis_register_sidebar( array(
    'id' => 'after-content-ad',
    'name' => __( 'After Content Ad', 'news' ),
    'description' => __( 'This is the after content ad section.', 'news' ),
    ) );

    Have a nice day.

    Maui

    #8157

    maui
    Participant
    Post count: 22

    I would like to use News frame with Decor design. Where I can find structure of News theme to add following div’s needed for Decor theme:

    div left-corner
    div right-corner

    They are located insde the wrap div.

    Thanks for your help.

    maui

    • This reply was modified 1 year, 9 months ago by  maui.
    • This reply was modified 1 year, 9 months ago by  maui.
    • This reply was modified 1 year, 9 months ago by  maui.
    • This reply was modified 1 year, 9 months ago by  Susan.
    • This reply was modified 3 months, 3 weeks ago by  nickthegeek.
    • This reply was modified 1 year, 9 months ago by  maui.
    • This reply was modified 1 year, 9 months ago by  maui.
    • This reply was modified 1 year, 9 months ago by  maui.
    • This reply was modified 1 year, 9 months ago by  Susan.
    • This reply was modified 3 months, 3 weeks ago by  nickthegeek.
    #8175

    AC
    Blocked
    Post count: 7712

    Yes, I believe so and remember you will need to add the styling from Decor to the new home.php you created.

    #8205

    Chris Cree
    Participant
    Post count: 147

    Look in the functions.php file that came with Decor. There you will see a function or two that adds those extra divs. Add the functions back into your new functions.php file.

    Here is the code you are looking for:

    [php]/** Add post/page wraps */
    add_action( ‘genesis_before_post_title’, ‘decor_start_post_wrap’ );
    add_action( ‘genesis_after_post_content’, ‘decor_end_post_wrap’ );

    function decor_start_post_wrap() {
    ?>
    <div class="wrap">
    <div class="left-corner"></div>
    <div class="right-corner"></div>
    <?php
    }

    function decor_end_post_wrap() {
    ?>
    </div>
    <?php
    }[/php]


    #8340

    maui
    Participant
    Post count: 22

    Chris,

    many thanks. It works on posts and pages but not on homepage. My main concern is to have most possible flexibility on homepage. May be it would be easier to include function of news-theme to decor theme? May be within loop?

    Maui

    #22930

    scoe
    Participant
    Post count: 57

    I have opened a genetic thread on “combining theme functionality”… it would be great if anyone who has done this successfully would share their tips.

    http://www.studiopress.com/forums/topic/combining-theme-functionality/

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

You must be logged in to reply to this topic.