• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

home.php like News for Decor theme

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

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

This topic is: not resolved
  • This topic has 5 replies, 4 voices, and was last updated 13 years, 7 months ago by scoe.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • December 27, 2012 at 7:01 am #7666
    maui
    Participant

    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

    December 29, 2012 at 10:29 am #8157
    maui
    Participant

    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

    December 29, 2012 at 11:10 am #8175
    AnitaC
    Keymaster

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


    Need help with customization or troubleshooting? Reach out to me.

    December 29, 2012 at 2:41 pm #8205
    Chris Cree
    Participant

    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:

    /** 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
    }
    December 30, 2012 at 7:12 am #8340
    maui
    Participant

    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

    February 26, 2013 at 10:47 am #22930
    scoe
    Member

    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.community/topic/combining-theme-functionality/

  • Author
    Posts
Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble