Community Forums › Forums › Archived Forums › Design Tips and Tricks › Balance Theme – Replace Home Page Posts with Widget
- This topic has 14 replies, 3 voices, and was last updated 10 years, 7 months ago by jenwilson.
-
AuthorPosts
-
January 20, 2014 at 10:44 am #86117jenwilsonMember
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/mwpdemoJanuary 20, 2014 at 2:04 pm #86141jenwilsonMemberHey 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. 🙂
January 21, 2014 at 10:23 am #86283jenwilsonMemberMorning...
Still looking for a bit on input on this one. 🙂
January 22, 2014 at 10:07 am #86472jenwilsonMemberStill trying to work this out. Any help or direction would be greatly appreciated.
Thanks
January 22, 2014 at 11:13 am #86484JohnParticipantHi 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 😉January 22, 2014 at 11:17 am #86485jenwilsonMemberThank 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. :-/
January 22, 2014 at 11:23 am #86488JohnParticipantWhere did you add the code in steps 1 and 2?
John Sundberg | blackhillswebworks.com
A WordPress developer’s toolbox: Firebug | WordPress Codex | Google 😉January 22, 2014 at 11:27 am #86490jenwilsonMemberStep 1 - Added to the bottom of the functions.php file
Step 2 - Added directly after the
<?php
of the home.php fileJanuary 22, 2014 at 12:18 pm #86499JohnParticipantIf 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 😉January 22, 2014 at 12:31 pm #86502jenwilsonMemberHmmmm... I will see if I can follow that.
What do you mean by "comment out"...
Thanks a lot for helping out with this.
January 22, 2014 at 12:39 pm #86505JohnParticipantIn 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 😉March 4, 2014 at 1:07 pm #93406JohnsonMktgMemberI'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
March 4, 2014 at 2:57 pm #93415JohnParticipantJohnsonMktg,
A link to your site would help.
John
John Sundberg | blackhillswebworks.com
A WordPress developer’s toolbox: Firebug | WordPress Codex | Google 😉March 5, 2014 at 7:59 am #93512JohnsonMktgMemberI 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!
March 5, 2014 at 9:26 am #93527jenwilsonMemberI will give it a go. Thank you JohnsonMktg. 🙂
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.