Community Forums › Forums › Archived Forums › Design Tips and Tricks › Remove primary bsidebar in Education
- This topic has 21 replies, 4 voices, and was last updated 11 years ago by abh.
-
AuthorPosts
-
January 28, 2013 at 9:37 am #15566wnbMember
Is it possible to remove the primary right widget and only have the secondary widget? They do it in this example: http://demo.studiopress.com/education/
My primary widget shows up even if I don't put anything in it.
Thanks in advance for help.....
January 28, 2013 at 2:15 pm #15661SoZoMemberBot the primary and secondary sidebars are shown in the demo. If you only want the secondary sidebar you would need to follow this tutorial on switching sidebars then set the home page to content-sidebar layout.
John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography
January 29, 2013 at 1:42 pm #16072wnbMemberSoZo, I switched to content sidebar and added this to styles.css but it still is not working. What have I done wrong?
<?php
add_action( 'genesis_after_header', 'be_change_sidebar_order' );
/**
* Swap Primary and Secondary Sidebars on Sidebar-Sidebar-Content
*
* @author Bill Erickson
* @link http://www.billerickson.net/switch-genesis-sidebars/
*/
function be_change_sidebar_order() {
$site_layout = genesis_site_layout();
if ( 'content-sidebar' == $site_layout ) {
// Remove the Primary Sidebar from the Primary Sidebar area.
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
// Place the Primary Sidebar into the Secondary Sidebar area.
add_action( 'genesis_sidebar_alt', 'genesis_do_sidebar' );
}January 29, 2013 at 1:43 pm #16073SoZoMemberThe style sheet is for CSS style rules. PHP goes in the templates, namely functions.php for this.
John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography
January 29, 2013 at 4:13 pm #16153wnbMemberSoZo, I put it in the function.php and I keep getting errors. Here is the one I have now:
Parse error: syntax error, unexpected '<' in /home/w446/public_html/K9/wp-content/themes/education/functions.php on line 98
I went ahead and put in the entire code at this point. Line 98 is the first linen which is the <?php. Should there be 2 curly brackets at the end? What have I done wrong?
Thanks for the help.....
<?php
add_action( 'genesis_after_header', 'be_change_sidebar_order' );
/**
* Swap Primary and Secondary Sidebars on Sidebar-Sidebar-Content
*
* @author Bill Erickson
* @link http://www.billerickson.net/switch-genesis-sidebars/
*/
function be_change_sidebar_order() {
$site_layout = genesis_site_layout();
if ( 'sidebar-sidebar-content' == $site_layout ) {
// Remove the Primary Sidebar from the Primary Sidebar area.
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
// Remove the Secondary Sidebar from the Secondary Sidebar area.
remove_action( 'genesis_sidebar_alt', 'genesis_do_sidebar_alt' );
// Place the Secondary Sidebar into the Primary Sidebar area.
add_action( 'genesis_sidebar', 'genesis_do_sidebar_alt' );
// Place the Primary Sidebar into the Secondary Sidebar area.
add_action( 'genesis_sidebar_alt', 'genesis_do_sidebar' );
}
}January 29, 2013 at 4:57 pm #16178SoZoMemberYou don't need the PHP opening tag, <?php , since your already in PHP in functions.php
John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography
January 29, 2013 at 6:40 pm #16215wnbMemberSoZo, thanks for the help but this is still not working. This time when I removed the <?php tag then it showed an error at line 114 that said :
Parse error: syntax error, unexpected $end in /home/w446/public_html/K9/wp-content/themes/education/functions.php on line 114 Line 1114 is simply /** Reposition Breadcrumbs */.I have gone in an loaded a fresh function.php to get it back up. But here is the function.php file that created the problem, can you see what the problem is?
Thanks again.......
<?php
/** Start the engine */
require_once( get_template_directory() . '/lib/init.php' );
/** Child theme (do not remove) */
define( 'CHILD_THEME_NAME', 'Education Theme' );
define( 'CHILD_THEME_URL', 'http://www.studiopress.com/themes/education' );
/** Create additional color style options */
add_theme_support( 'genesis-style-selector', array(
'education-black' => __( 'Black' , 'education' ),
'education-green' => __( 'Green' , 'education' ),
'education-purple' => __( 'Purple' , 'education' ),
'education-red' => __( 'Red' , 'education' ),
'education-teal' => __( 'Teal' , 'education' )
) );
add_action( 'genesis_meta', 'education_add_viewport_meta_tag' );
/** Add Viewport meta tag for mobile browsers */
function education_add_viewport_meta_tag() {
echo '<meta name="viewport" content="width=device-width, initial-scale=1.0"/>';
}
/** Add new image sizes */
add_image_size( 'featured-image', 150, 100, TRUE );
/** Add structural wraps */
add_theme_support( 'genesis-structural-wraps', array(
'header',
'nav',
'subnav',
'inner',
'footer-widgets',
'footer'
) );
/** Add support for custom background */
add_theme_support( 'custom-background' );
/** Add support for custom header */
add_theme_support( 'genesis-custom-header', array(
'width' => 1140,
'height' => 120
) );
/** Add support for 3-column footer widgets */
add_theme_support( 'genesis-footer-widgets', 3 );
/** Reposition Primary Navigation */
remove_action( 'genesis_after_header', 'genesis_do_nav' );
add_action( 'genesis_before_content_sidebar_wrap', 'genesis_do_nav' );
/** Reposition Secondary Navigation */
remove_action( 'genesis_after_header', 'genesis_do_subnav' );
add_action( 'genesis_before_content_sidebar_wrap', 'genesis_do_subnav' );
/** Reposition Breadcrumbs */
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
add_action( 'genesis_before_content', 'genesis_do_breadcrumbs' );
add_filter( 'genesis_comment_list_args', 'child_comment_list_args' );
/** Change avatar size */
function child_comment_list_args( $args ) {
$args = array(
'type' => 'comment',
'avatar_size' => 33,
'callback' => 'genesis_comment_callback'
);
return $args;
}
/** Register widget areas */
genesis_register_sidebar( array(
'id' => 'slider',
'name' => __( 'Slider', 'education' ),
'description' => __( 'This is the slider section.', 'education' ),
) );
genesis_register_sidebar( array(
'id' => 'intro',
'name' => __( 'Intro', 'education' ),
'description' => __( 'This is the intro section displayed below the slider.', 'education' ),
) );
genesis_register_sidebar( array(
'id' => 'featured',
'name' => __( 'Featured', 'education' ),
'description' => __( 'This is the featured section displayed below the intro.', 'education' ),
) );
genesis_register_sidebar( array(
'id' => 'call-to-action',
'name' => __( 'Call To Action', 'education' ),
'description' => __( 'This is the call to action banner.', 'education' ),
) );
add_action( 'genesis_after_header', 'be_change_sidebar_order' );
/**
* Swap Primary and Secondary Sidebars on Sidebar-Sidebar-Content
*
* @author Bill Erickson
* @link http://www.billerickson.net/switch-genesis-sidebars/
*/
function be_change_sidebar_order() {
$site_layout = genesis_site_layout();
if ( 'sidebar-sidebar-content' == $site_layout ) {
// Remove the Primary Sidebar from the Primary Sidebar area.
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
// Remove the Secondary Sidebar from the Secondary Sidebar area.
remove_action( 'genesis_sidebar_alt', 'genesis_do_sidebar_alt' );
// Place the Secondary Sidebar into the Primary Sidebar area.
add_action( 'genesis_sidebar', 'genesis_do_sidebar_alt' );
// Place the Primary Sidebar into the Secondary Sidebar area.
add_action( 'genesis_sidebar_alt', 'genesis_do_sidebar' );
}
January 29, 2013 at 6:41 pm #16217SoZoMemberIf you're copy/pasting from somewhere make sure that all the quotes are plain quotes and not curly quotes.
John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography
January 29, 2013 at 6:54 pm #16223wnbMemberOK, i redid it all removed the curly brackets } at the very end with ) I still get the error for Parse error: syntax error, unexpected ')' in /home/w446/public_html/K9/wp-content/themes/education/functions.php on line 117 which is again /** Reposition Breadcrumbs */
January 29, 2013 at 8:29 pm #16256wnbMemberbump
January 29, 2013 at 9:45 pm #16293SoZoMemberJanuary 29, 2013 at 9:48 pm #16295wnbMemberI've tried it with and without the curly brackets and still no luck I keep getting that error message.
February 1, 2013 at 11:29 am #17104avhslibraryMemberDid you find an answer wnb? I'm looking to do the same thing.
February 1, 2013 at 11:42 am #17106wnbMemberavhslibrary, no I didn't. I tried everything above but could not get past the problems. Please let me know if you find an answer and I'll do the same.
Thanks
February 1, 2013 at 12:57 pm #17132avhslibraryMemberThis is what I want (and I think) what wnb wants as well: http://saintspride.com/admissions/admissions/
A site where the secondary sidebar is there and the primary is not and the content fills the entire page.
February 1, 2013 at 1:05 pm #17136SoZoMemberYa, you'd need to set the layout to content-sidebar and then switch the sidebars with Bill's code since there isn't a content/secondary-sidebar layout.
John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography
February 1, 2013 at 1:58 pm #17152wnbMemberSoZo we were never able to get past the errors that was being created ....any ideas what the problem could be or what I can show you to see what I am doing wrong?
Thanks again
February 1, 2013 at 1:59 pm #17153wnbMemberSoZo we were never able to get past the errors that were being creayed with the code. Is there anything I can show you to see what I am doing wrong?
Thanks
February 1, 2013 at 2:38 pm #17169avhslibraryMemberOk, I followed Bill's advice.
http://www.amadorvalleyhs.org/?page_id=956
And the sidebar's did switch. I set the secondary sidebar not to come back. Unfortunately, there is still a space where it should be.
February 1, 2013 at 2:50 pm #17181wnbMemberYes I see that big space where the sidebar should be, that won't work....
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.