Community Forums › Forums › Archived Forums › Design Tips and Tricks › Remove bottom section from home page?
Tagged: home bottom
- This topic has 18 replies, 2 voices, and was last updated 11 years, 1 month ago by Brad Dalton.
-
AuthorPosts
-
February 20, 2013 at 1:59 pm #21770volvoxMember
Hello - Here the home.php from the corporate theme - how can i remove the bottom section widget 1, 2 and 3 from showing on the page - and only on the home page
<?php
add_action( 'genesis_meta', 'corporate_home_genesis_meta' );
/**
* Add widget support for homepage. If no widgets active, display the default loop.
*
*/
function corporate_home_genesis_meta() {
if ( is_active_sidebar( 'featured' ) || is_active_sidebar( 'home-middle-1' ) || is_active_sidebar( 'home-middle-2' ) || is_active_sidebar( 'home-middle-3' ) ) {
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'corporate_home_loop_helper' );
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
}
}/**
* Display widget content for "featured" and "home-middle" sections
*
*/
function corporate_home_loop_helper() {echo '<div id="featured"><div class="wrap">';
dynamic_sidebar( 'featured' );
echo '</div></div><!-- end #featured -->';
echo '<div id="home-middle"><div class="wrap">';if ( is_active_sidebar( 'home-middle-1' ) ) {
echo '<div class="home-middle-1">';
dynamic_sidebar( 'home-middle-1' );
echo '</div><!-- end .home-middle-1 -->';
}if ( is_active_sidebar( 'home-middle-2' ) ) {
echo '<div class="home-middle-2">';
dynamic_sidebar( 'home-middle-2' );
echo '</div><!-- end .home-middle-2 -->';
}if ( is_active_sidebar( 'home-middle-3' ) ) {
echo '<div class="home-middle-3">';
dynamic_sidebar( 'home-middle-3' );
echo '</div><!-- end .home-middle-3 -->';
}echo '</div></div><!-- end #home-bottom -->';
}genesis();
Thanks
February 21, 2013 at 7:56 am #21945Brad DaltonParticipantadd_action('get_footer', 'child_remove_genesis_do_footer'); function child_remove_genesis_do_footer() { if (is_home()) { remove_action('genesis_footer', 'genesis_do_footer'); remove_action('genesis_footer', 'genesis_footer_markup_open', 5); remove_action('genesis_footer', 'genesis_footer_markup_close', 15); } }
Add this to your child themes functions.php file
February 23, 2013 at 2:08 am #22366volvoxMemberHello - thanks... the above code does'nt do it! Adding the code to the function.php file gives me an error ( blank page).
And this is the home-bottom section i want to remove from the home page - not the footer. There are three home-bottom sections (1,2,3), similar to the home-middle sections.
February 23, 2013 at 5:38 am #22372Brad DaltonParticipantThis will hide the home-middle widgets from displaying.
#home-middle { display: none; }
Maybe you have some custom coding for home-bottom as i couldn't see it on the functions.php or widgets page.
You could trying something like this:
#home-bottom { display: none; }
As long as the selector is the same as #home-bottom which you can inspect using the Firebug addon.
February 23, 2013 at 7:16 am #22383volvoxMemberThanks....
The tag is footer-widgets
Since i want to touch the the home page only (so the CSS trick can't be applied) i came back with your first suggestion editing the function, but still get error!
Here the whole original function.php file:
<?php
/** Start the engine */
require_once( TEMPLATEPATH . '/lib/init.php' );/** Child theme (do not remove) */
define( 'CHILD_THEME_NAME', 'Corporate Theme' );
define( 'CHILD_THEME_URL', 'http://www.studiopress.com/themes/corporate' );$content_width = apply_filters( 'content_width', 620, 450, 930 );
/** Add new image sizes */
add_image_size( 'featured', 500, 240, TRUE );
add_image_size( 'home-middle', 275, 100, TRUE );/** Add suport for custom background */
add_custom_background();/** Add support for custom header */
add_theme_support( 'genesis-custom-header', array( 'width' => 960, 'height' => 130, 'textcolor' => 'ffffff', 'admin_header_callback' => 'corporate_admin_style' ) );/**
* Register a custom admin callback to display the custom header preview with the
* same style as is shown on the front end.
*
*/
function corporate_admin_style() {$headimg = sprintf( '.appearance_page_custom-header #headimg { background: url(%s) no-repeat; font-family: Droid Sans, arial, serif; min-height: %spx; text-shadow: #000 1px 1px; }', get_header_image(), HEADER_IMAGE_HEIGHT );
$h1 = sprintf( '#headimg h1, #headimg h1 a { color: #%s; font-size: 30px; font-weight: normal; line-height: 30px; margin: 40px 0 0 15px; text-decoration: none; }', esc_html( get_header_textcolor() ) );
$desc = sprintf( '#headimg #desc { color: #%s; font-size: 16px; line-height: 1; margin: 10px 0 0 30px; }', esc_html( get_header_textcolor() ) );printf( '<style type="text/css">%1$s %2$s %3$s</style>', $headimg, $h1, $desc );
}
/** Change breadcrumb location */
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
add_action( 'genesis_after_header', 'genesis_do_breadcrumbs' );/** Add support for 3-column footer widgets */
add_theme_support( 'genesis-footer-widgets', 3 );/** Register widget areas */
genesis_register_sidebar( array(
'id' => 'featured',
'name' => __( 'Featured', 'corporate' ),
'description' => __( 'This is the featured section.', 'corporate' ),
) );
genesis_register_sidebar( array(
'id' => 'home-middle-1',
'name' => __( 'Home Middle #1', 'corporate' ),
'description' => __( 'This is the home middle #1 section.', 'corporate' ),
) );
genesis_register_sidebar( array(
'id' => 'home-middle-2',
'name' => __( 'Home Middle #2', 'corporate' ),
'description' => __( 'This is the home middle #2 section.', 'corporate' ),
) );
genesis_register_sidebar( array(
'id' => 'home-middle-3',
'name' => __( 'Home Middle #3', 'corporate' ),
'description' => __( 'This is the home middle #3 section.', 'corporate' ),
) );
?>February 23, 2013 at 7:19 am #22385volvoxMemberAnd for reference here is the page.
Thanks
February 23, 2013 at 7:46 am #22388Brad DaltonParticipant.home is the class selector
#footer-widgets is the i.d selectorHere's the new rule to hide your footer widgets using CSS
.home #footer-widgets { display: none; }
Add it to the end of your child themes style.css file
Display:none is your declaration which consists of a property and value
display is the property
none is the valueFurther learning
1. http://www.w3schools.com/css/css_id_class.asp
2. http://www.htmldog.com/guides/cssintermediate/classid/You can also use PHP code to remove footer widgets on specific pages using conditional tags example: is_home()
Another option is to install the Widget Logic plugin and add a conditional tag to each footer widget.
Example: !is_home() which will hide the widgets from displaying on the home page only
ref: http://codex.wordpress.org/Conditional_Tags
February 23, 2013 at 9:42 am #22402volvoxMemberNice - thanks a lot for hints and references - very useful
I have used the CSS rule but will also try the function.
February 26, 2013 at 5:16 am #22871volvoxMemberHello - i reopen the post for another related question
Here i want to remove the footer-widgets sections from an archive template page i have done.
Obviously a trick like
.archive #footer-widgets {
display
:
none
;
}
does not work!
In fact, what is the conditional tag name for this custom archive page i have created ?
(Template Name is 'Category Archive', File name is 'page-catarchive.php'.Thanks
February 26, 2013 at 5:45 am #22874Brad DaltonParticipantFebruary 26, 2013 at 6:30 am #22877volvoxMemberOK thanks.
then i'm back to the removing function ... such as
add_action('get_footer-widgets', 'child_remove_genesis_do_footer-widgets');
function child_remove_genesis_do_footer-widgets() {
if (is_page_template(page-catarchive.php)) {
remove_action('genesis_footer-widgets', 'genesis_do_footer-widgets');
}
}
with no success !(page for which the 3 footer-widgets must be removed is: http://volvoxsoft.com/calendrier/)
February 26, 2013 at 6:51 am #22880Brad DaltonParticipantFebruary 26, 2013 at 7:06 am #22883volvoxMemberGreat - i have much to learn!
Thanks
February 26, 2013 at 7:17 am #22885volvoxMemberBy the way - which way is better in order to remove/hide widgets from specific page?
- CSS (hide) or a function ?
February 26, 2013 at 7:18 am #22886Brad DaltonParticipantA suggestion if i may Volvox.
Try installing the Firebug addon for Firefox and learning the basics of CSS http://www.w3schools.com/css/
February 26, 2013 at 7:21 am #22887Brad DaltonParticipantPro's and Con's for both.
PHP enables you to remove everything which is output into HTML at the server level where it is processed whereas CSS enables you to hide the display using the browser
February 26, 2013 at 7:22 am #22888volvoxMemberI did install Firebug for Firefox.
As i asked before, which way is better - hide widgets using CSS or use of a php function to remove it?
February 26, 2013 at 7:36 am #22890volvoxMemberTHanks for above answer -
I will try to remove the footer-widgets using a function (re: your ref here: http://wpsites.net/best-plugins/remove-widgets/ )
February 26, 2013 at 7:37 am #22891Brad DaltonParticipantPersonal opinion Volvox. I prefer PHP whereas some people prefer CSS.
Ask the community in the general discussion forum and see what others prefer.
Please mark this as resolved before starting another thread. Thanks
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.