Balance Theme – Replace Home Page Posts with Widget

Community Forums Forums Design Tips and Tricks Balance Theme – Replace Home Page Posts with Widget

This topic is: not resolved

Tagged: ,

This topic contains 14 replies, has 3 voices, and was last updated by  jenwilson 7 months, 3 weeks ago.

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #86117

    jenwilson
    Participant
    Post count: 11

    I would like to replace the “recent posts” section of the home page with just a text widget area. I have registered additional widget areas before but only in the sidebar.

    Any or help or direction would be greatly appreciated.

    http://agentsolutions.ca/mwpdemo
    #86141

    jenwilson
    Participant
    Post count: 11

    Hey there,

    I was able to get a widget registered for the home page, however there is a slight alignment issue. The sidebar is being pushed down.

    Any suggestions how I resolve the alignment so the sidebar sits normally to the right of the widget and post area?

    Thanks in advance. :-)

    #86283

    jenwilson
    Participant
    Post count: 11

    Morning…

    Still looking for a bit on input on this one. :-)

    #86472

    jenwilson
    Participant
    Post count: 11

    Still trying to work this out. Any help or direction would be greatly appreciated.

    Thanks

    #86484

    John
    Participant
    Post count: 157

    Hi Jennifer,

    It looks like you might have added the new widget area in the wrong place, or something along those lines, since your sidebar is now outside of your “content-sidebar-wrap” div container.

    John


    John Sundberg | blackhillswebworks.com
    A WordPress developer’s toolbox: Firebug | WordPress Codex | Google ;)

    #86485

    jenwilson
    Participant
    Post count: 11

    Thank you so much John. This is the code I used:

    Step 1

    genesis_register_sidebar( array(
        'id' => 'home-featured',
        'name' => __( 'Home Featured', 'balance' ),
        'description' => __( 'This is the home featured section.', 'balance' ),
    ) );

    Step 2

    /** Add the home featured section */
    add_action( 'genesis_before_loop', 'balance_home_featured' );
    function balance_home_featured() {
    
        /** Do nothing on page 2 or greater */
        if ( get_query_var( 'paged' ) >= 2 )
            return;
    
        genesis_widget_area( 'home-featured', array(
        'before' => '
    ',
        ) );
    
    }

    Step 3

    .home-featured {
        background-color: #f5f5f5;
        border: 1px solid #ddd;
        float: left;
    }

    Not sure exactly where I went wrong. :-/

    #86488

    John
    Participant
    Post count: 157

    Where did you add the code in steps 1 and 2?


    John Sundberg | blackhillswebworks.com
    A WordPress developer’s toolbox: Firebug | WordPress Codex | Google ;)

    #86490

    jenwilson
    Participant
    Post count: 11

    Step 1 – Added to the bottom of the functions.php file

    Step 2 – Added directly after the <?php of the home.php file

    #86499

    John
    Participant
    Post count: 157

    If I were doing this, I would probably handle step 2 differently.

    Instead, in home.php I would copy the two sections of code for the home-featured-left and -right widget areas, paste that code below those sections (and above the ‘loop’ actions, and then modify the code to reflect the ‘home-featured’ widget area you’re wanting to achieve.

    Then I would comment out the line that says

    
    add_action( 'genesis_loop', 'child_grid_loop_helper' );
    

    or just remove it and the child_grid_loop_helper function.

    Finally, finish with whatever CSS edits are necessary to complete.


    John Sundberg | blackhillswebworks.com
    A WordPress developer’s toolbox: Firebug | WordPress Codex | Google ;)

    #86502

    jenwilson
    Participant
    Post count: 11

    Hmmmm… I will see if I can follow that.

    What do you mean by “comment out”…

    Thanks a lot for helping out with this.

    #86505

    John
    Participant
    Post count: 157

    In PHP you can comment out a line by adding // to the beginning of that line. Or you can comment out a block of PHP code by wrapping it in /* and */, much like CSS comments.

    When you comment something in the code, your server ignores whatever is in the commented area.


    John Sundberg | blackhillswebworks.com
    A WordPress developer’s toolbox: Firebug | WordPress Codex | Google ;)

    #93406

    JohnsonMktg
    Member
    Post count: 7

    I’m having a similar issue with the Education theme…. I’ve registered an extra widget in the functions.php file using:

    genesis_register_sidebar( array(
    	'id'			=> 	'close',
    	'name'			=>	__( 'Close', 'education' ),
    	'description'	=>	__( 'This is the close section displayed below the call to action banner.', 'education' ),
    
    ) );

    and then added the widget hook to the home.php file as follows:

    /** Add the home close section */
    add_action( 'genesis_before_loop', 'education_close' );
    function education_close() {
    
        /** Do nothing on page 2 or greater */
        if ( get_query_var( 'paged' ) >= 2 )
            return;
    
        genesis_widget_area( 'close', array(
        'before' => '
    ',
        ) );
    
    }

    however, no matter where i put the code to the home.php it shoves my sidebars underneath…. so any help would definitely be appreciated

    #93415

    John
    Participant
    Post count: 157

    JohnsonMktg,

    A link to your site would help.

    John


    John Sundberg | blackhillswebworks.com
    A WordPress developer’s toolbox: Firebug | WordPress Codex | Google ;)

    #93512

    JohnsonMktg
    Member
    Post count: 7

    I figurd it out John… Thanks tho! However, Jen here is the code in the home.php i used after registering the new widget in functions.php:

    /** Add the home close section */
    add_action( 'genesis_after_content', 'education_close' );
    function education_close() {   
    /** Do nothing on page 2 or greater */
        if ( get_query_var( 'paged' ) >= 2 )
            return;
    
        genesis_widget_area( 'close', array(
        'before' => '<div class="after-post widget-area">',
    			'after' => '</div>',
      ) );
    
    }

    All you should have to do is change the “education_close” to balance_home_featured or and “close” to home_featured or whatever your new widget name is and it should work perfectly!

    #93527

    jenwilson
    Participant
    Post count: 11

    I will give it a go. Thank you JohnsonMktg. :-)

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

You must be logged in to reply to this topic.