Widget Ready Home Page Modern Blogger Pro

Community Forums Forums Design Tips and Tricks Widget Ready Home Page Modern Blogger Pro

This topic is: not resolved

This topic contains 11 replies, has 3 voices, and was last updated by  krystyn 4 months, 3 weeks ago.

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #111818

    krystyn
    Participant
    Post count: 152

    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.

    http://www.studiopress.com/forums/topic/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
    #111844

    braddalton
    Participant
    Post count: 10587

    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


    #111862

    krystyn
    Participant
    Post count: 152

    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.

    #111929

    braddalton
    Participant
    Post count: 10587
    #111968

    krystyn
    Participant
    Post count: 152

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

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

    #111973

    braddalton
    Participant
    Post count: 10587

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

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


    #111974

    krystyn
    Participant
    Post count: 152

    To register the widgets, I used the tutorial here and swapped out the names: http://www.studiopress.com/forums/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.

    #112303

    krystyn
    Participant
    Post count: 152

    @braddalton, I forgot to tag you.

    #112307

    Tonya
    Member
    Post count: 190

    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

    Web developer, Software & Electrical Engineer, Bringing ideas to life is my art
    Find Me: tonyadoescode.com | Twitter | GitHub | Customize without touching the child theme

    • This reply was modified 4 months, 4 weeks ago by  Tonya.
    • This reply was modified 4 months, 4 weeks ago by  Tonya.
    #112504

    krystyn
    Participant
    Post count: 152

    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.

    #112556

    braddalton
    Participant
    Post count: 10587

    There’s multiple problems with the code Krystyn.


    #112638

    krystyn
    Participant
    Post count: 152

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

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

You must be logged in to reply to this topic.