Community Forums › Forums › Archived Forums › Design Tips and Tricks › Home Page Layout Problem
- This topic has 5 replies, 3 voices, and was last updated 10 years, 8 months ago by eskape.
-
AuthorPosts
-
August 20, 2013 at 6:11 pm #57803eskapeMember
Hey guys I'm new here and I just bought the Genesis framework. I bought just the framework with no child theme. I know how to customize a normal wordpress theme but I'm a complete noob when it comes to Genesis.
Yesterday I started creating a new site and I was able to add two new widget areas to the homepage. First I added a slider widget area at the top and right below that I added the featured page widget area.
This is the code I added to my functions.php file for it to show up on the homepage.
//* Slider Widget Area
genesis_register_sidebar( array(
'id' => 'slider-widget-area',
'name' => 'Slider Widget Area',
'description' => 'This is the homepage slider widget area.',
) );add_action( 'genesis_before_content', 'slider_widget_area_sidebar' );
/** Loads a new sidebar after the content */
function slider_widget_area_sidebar() {
if ( ! is_home() )
return;
echo '<div class="slider-widget-area">';
dynamic_sidebar( 'slider-widget-area' );
echo '</div>';}
//* Featured Post Widget Area
genesis_register_sidebar( array(
'id' => 'featured-post-widget-area',
'name' => 'Featured Post Widget Area',
'description' => 'This is the homepage featured post widget area.',
) );add_action( 'genesis_before_content', 'featured_post_widget_area_sidebar' );
/** Loads a new sidebar after the content */
function featured_post_widget_area_sidebar() {
if ( ! is_home() )
return;
echo '<div class="featured-post-widget-area">';
dynamic_sidebar( 'featured-post-widget-area' );
echo '</div>';
}*the featured post widget area is actually for featured pages*
I also plan on adding a welcome text under the featured pages widget area.This code works perfectly for me except for one problem. The recent blog posts still show up at the bottom of the page and I want to remove them because I want the homepage to only show the slider, featured pages, and a welcome text.
how can I remove the recent blog posts that show up at the bottom of the homepage?
I'm using: Genesis 2.0 and WordPress 3.6
also, I tried creating a page template but I couldn't get it to work.
http://www.genesistest.cinevallarta.comAugust 21, 2013 at 9:16 am #57927AnitaKeymasterYou should not be modifying the framework. You should be using the Sample Child Theme with the framework. When Genesis is updated, all of your edits will be overwritten. You can locate the child theme under my.studiopress.com. The framework is just that - a framework, you can customize the sample.
Love coffee, chocolate and my Bella!
August 21, 2013 at 9:35 am #57940eskapeMemberI'm sorry maybe I didn't say it but I am using a child theme. I added that code to the functions.php file in the child theme. I think I might have to remove the loop or modify it. Do you have any suggestions on how I can remove the recent posts from th bottom of the home page?
August 21, 2013 at 10:18 am #57951marybaumParticipantI'll second Anita's direction - you want to make your changes to the Sample child theme, not the framework.
So once you restore your framework files to the original and transfer the above code to your new child theme, the way you get rid of the recent posts is to disable the loop on the home page.
As in:
remove_action( 'genesis_loop', 'genesis_do_loop' );
Since you're only trying to disable the loop on the home page, add this line to the top of home.php - you'll have nuked recent posts from the entire page. If you decide you want to show recent posts in some area of the home page after all, just put the loop back in the div you want the posts in.
Note that the html5 markup refers to posts as entries, so we'll make up a CSS div class called 'entries' to hold the loop.
On the home page, you'd do something like:
if is_active_sidebar ('entries') {
echo '<div class="entries">';
dynamic_sidebar( 'entries' );
add_action( 'genesis_loop', 'genesis_do_loop' );
echo '</div>';
};You'll also need to register this sidebar in functions.php:
genesis_register_sidebar( array(
'id' => 'entries',
'name' => __( 'entries, 'yourchildtheme' ),
'description' => __( 'This is the entries area on the home page.', 'yourchildtheme' ),
) );Better coders than I might do this whole operation without making the entries class a dynamic sidebar - a widget area, in other words. But I'm a bit like that queen in the fairy tale who knows the answers to three questions; I know three functions and how to write an if statement. 😉
For one thing, this half-@$$ed method is going to add a widget area to your admin that may confuse you and will definitely confuse users who don't grok what we did here - and may well stick actual widgets in there and not like the results.
So I'd love to see more elegant ways of doing this.
Sharing the good news about the wonders of modern CSS and the split-step. Either one should get you moving fast. 😀
August 21, 2013 at 11:24 am #57965eskapeMemberHi Mary thanks for your response. I never made any changes to the framework files. When I bought genesis it came with a simple child theme called "genesis-sample". It only had a functions.php file and style.css file. I added the code above to functions.php file in the childe theme.
My child theme didn't come with a home.php file so I created one and added the remove_action code but it didn't work. The only thing that happened was the homepage was completely white and no content. Yesterday I added that remove_action code to my functions.php file and it got rid of the recent posts at the bottom of the page but it also left the rest of my pages / posts blank.
Any ideas?
August 21, 2013 at 11:56 am #57972eskapeMemberI fixed it!!!!! Mary you were right but I needed one extra line of code. I'll explain what I did so if anyone else has the same problem they can fix it.
in my child theme's functions.php file I registered the widget areas and created the add_action function using the code below so they would show up on certain hooks on the homepage.
//* Slider Widget Area
genesis_register_sidebar( array(
‘id’ => ‘slider-widget-area’,
‘name’ => ‘Slider Widget Area’,
‘description’ => ‘This is the homepage slider widget area.’,
) );add_action( ‘genesis_before_content’, ‘slider_widget_area_sidebar’ );
/** Loads a new sidebar after the content */
function slider_widget_area_sidebar() {
if ( ! is_home() )
return;
echo ‘<div class=”slider-widget-area”>’;
dynamic_sidebar( ‘slider-widget-area’ );
echo ‘</div>’;}
//* Featured Post Widget Area
genesis_register_sidebar( array(
‘id’ => ‘featured-post-widget-area’,
‘name’ => ‘Featured Post Widget Area’,
‘description’ => ‘This is the homepage featured post widget area.’,
) );add_action( ‘genesis_before_content’, ‘featured_post_widget_area_sidebar’ );
/** Loads a new sidebar after the content */
function featured_post_widget_area_sidebar() {
if ( ! is_home() )
return;
echo ‘<div class=”featured-post-widget-area”>’;
dynamic_sidebar( ‘featured-post-widget-area’ );
echo ‘</div>’;
}Next I created a home.php file in my child theme because my child theme didn't come with one. I took Mary's advice and added the remove_action code but I needed an extra line of code to bring the rest of the site back. This is the code I added to the home.php file.
<?php
remove_action( 'genesis_loop', 'genesis_do_loop' );
genesis();
the code Mary left out was "genesis();"
Thanks Mary! I hope this can help someone else too.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.