• 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

Widget Ready Home Page Modern Blogger Pro

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 › Widget Ready Home Page Modern Blogger Pro

This topic is: not resolved

Tagged: modern blogger pro

  • This topic has 11 replies, 3 voices, and was last updated 9 years, 5 months ago by krystyn.
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • June 27, 2014 at 5:31 pm #111818
    krystyn
    Participant

    I'd like to make the home page of modern blogger pro widget ready so I can use featured post and do several different arrangements of posts (ie large featured, then two rows side by side, then another large featured).

    I've used this tutorial and added everything.

    Add additional featured widget on homepage of Blissful

    There was some stuff on home.php originally but I had to delete it for the page to display. However, I've added a widget to "home top" (the widgets seem to have registered perfectly), but the home page isn't displaying the featured posts I've put in home top.

    The original home.php:
    add_action( 'genesis_meta', 'modernbloggerpro_home_genesis_meta' );
    /**
    * Add widget support for homepage.
    *
    */
    function modernbloggerpro_home_genesis_meta() {

    if ( is_active_sidebar( 'slider' )) {

    add_action( 'genesis_before_loop', 'modernbloggerpro_home_loop_helper' );

    }
    }

    /** Remove the ad widget **/
    remove_action( 'genesis_before_loop', 'adspace_before_loop' );

    /**
    * Display widget content for home slider section
    *
    */
    function modernbloggerpro_home_loop_helper() {

    if ( is_active_sidebar( 'slider' )) {

    echo '<div id="slider">';
    echo '<div class="slider">';
    dynamic_sidebar( 'slider' );
    echo '</div><!-- end .slider -->';
    echo '</div><!-- end #slider -->';

    }

    }

    My new home.php:

    <?php

    add_action( 'genesis_meta', 'modern_home_genesis_meta' );
    /**
    * Add widget support for homepage. If no widgets active, display the default loop.
    *
    */
    function modernbloggerpro_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', 'news_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[] = 'modernbloggerpro';
    return $classes;
    }

    }
    }

    function news_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();

    Is it because there are other widgets in there? Like slider and portfolio? What did I miss?

    http://www.krizzydesigns-test.com/test3
    June 28, 2014 at 12:02 am #111844
    Brad Dalton
    Participant

    This code cannot be tested because it breaks when you embed PHP directly into a webpage.

    Please paste PHP code into a Github Gist and then link to it or embed it here. Thanks


    Tutorials for StudioPress Themes.

    June 28, 2014 at 7:53 am #111862
    krystyn
    Participant

    Sorry about that @braddalton. Hopefully this works.

    Here's my original home edits (ie, what I'm using now):
    <script src="https://gist.github.com/anonymous/0096407243bad8f64110.js"></script>

    Here's the modern home code that comes with the theme:

    <script src="https://gist.github.com/anonymous/4afd5f28b9fe6575c86f.js"></script>

    When I tried to combine the two nothing loaded on the home page at all. No header, no background, anything. Just a white space.

    June 28, 2014 at 10:34 pm #111929
    Brad Dalton
    Participant

    Where's the combined code?


    Tutorials for StudioPress Themes.

    June 29, 2014 at 8:07 am #111968
    krystyn
    Participant

    @braddalton let me try one more time. Sorry about that.

    <script src="https://gist.github.com/anonymous/e131e74e816288614be4.js"></script>

    June 29, 2014 at 9:15 am #111973
    Brad Dalton
    Participant

    But where's the functions code which registers all the widgets?

    Also, have you posted this on the theme Devs support forum?


    Tutorials for StudioPress Themes.

    June 29, 2014 at 9:22 am #111974
    krystyn
    Participant

    To register the widgets, I used the tutorial here and swapped out the names: http://www.studiopress.community/topic/add-additional-featured-widget-on-homepage-of-blissful/

    I haven't posted on the support page as it says that customizations aren't part of the help.

    Here's the entirety of my functions.php:

    <script src="https://gist.github.com/anonymous/6e1128b0fb16387f428e.js"></script>

    I feel like I've just got one thing wrong and I can't figure it out. I know (think?) they are registered fine because they show on the widgets page. And, I can add things (and have added things to them), but the home page isn't changing and instead is just showing the most recent posts in order.

    June 30, 2014 at 8:48 pm #112303
    krystyn
    Participant

    @braddalton, I forgot to tag you.

    June 30, 2014 at 10:02 pm #112307
    Tonya
    Member

    Hi,

    Notice that the function for your new widgets is called: news_home_loop_helper(); However, in the function modernbloggerpro_home_genesis_meta(), it is referencing the wrong function name: add_action( 'genesis_loop', 'modernbloggerpro_home_loop_helper' );

    add_action( 'genesis_meta', 'modern_home_genesis_meta' );
    /**
     * Add widget support for homepage. If no widgets active, display the default loop.
     *
     */
    function modernbloggerpro_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', 'news_home_loop_helper' ); // Changed from modernbloggerpro_home_loop_helper

    Software & Electrical Engineer and Programming Teacher ยท I’m on a mission to help developers be more awesome.
    Find Me: KnowTheCode.io | @hellofromTonya | Profitable WordPress Developer Bootcamp

    July 1, 2014 at 2:11 pm #112504
    krystyn
    Participant

    Thanks @tonya_lunarwp for the catch. I've changed it with no luck. I've added genesis grid to add some options, but it's not idea. I can't figure out what's wrong.

    July 1, 2014 at 10:09 pm #112556
    Brad Dalton
    Participant

    There's multiple problems with the code Krystyn.


    Tutorials for StudioPress Themes.

    July 2, 2014 at 9:04 am #112638
    krystyn
    Participant

    Okay, @braddalton, I guess I will have to start over.

  • Author
    Posts
Viewing 12 posts - 1 through 12 (of 12 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

© 2023 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