Group Mods

  • Profile picture of @mercime
  • Profile picture of r-a-y
  • Profile picture of Hugo

how to remove the SideBar from registration-page ? (9 posts)

Started 1 year, 10 months ago by: abcde666

  • Profile picture of abcde666 abcde666 said 1 year, 10 months ago:

    how to remove the SideBar from the registration-page ?
    So meaning I do not want to have the SideBar at this very specific page at which the user is creating a new account.

    Does anyone have an idea of how to do that ?

    Many thanks,
    Erich

  • Profile picture of @mercime @mercime said 1 year, 10 months ago:

    At least two ways – assuming you’re using child theme of bp-default:
    1. in style.css only
    body.registration #sidebar { display: none; }
    body.registration div#content div.padder { margin-right: 0px; border-right: none; }

    2. Template change plus one line in style.css
    copy register.php from bp-default/registration/register.php to your child-theme-folder/registration/register.php
    replace div class=”padder” with div class=”padderwide”
    delete line [?php locate_template( array( 'sidebar.php' ), true ) ?]

    in style.css add
    .padderwide { padding: 20px; }

  • Profile picture of abcde666 abcde666 said 1 year, 10 months ago:

    Hey mercime,

    many thanks for your help, that is what I was looking for !

    I just deleted the line you have mentioned from my register.php file and it worked like a charm.

    Thanks again !

  • Profile picture of naijaping naijaping said 1 year ago:

    hi, i just follow this instruction using option 1 i put this code in my style.css

    body.registration #sidebar { display: none; }
    body.registration div#content div.padder { margin-right: 0px; border-right: none; }

    and it worked, but how can i set the form to full page or make it center.

    see here ; http://www.naijaping.com/register/

    regards

  • Profile picture of Hugo Hugo said 1 year ago:
    body.register div#content {
        margin-right:0;
        padding:0;
        width:100%;
    }
  • Profile picture of naijaping naijaping said 1 year ago:

    thanks hnla you are a star, it worked like a charm. one more question, can i use this code to remove sidebar from a page aswell. for example, “Terms of service”

  • Profile picture of Hugo Hugo said 1 year ago:

    Yes and no, you would need to change the body class token body.register is particular to the registration page so you would need to do something like:

    body.page-id-1215 #content,
    body.register div#content {
        margin-right:0;
        padding:0;
        width:100%;
    }

    page-id-1215 is the only unique identifier of that page.

    However this approach isn’t really the best one, it would be better to be using a onecolumn-page.php template that has the sidebar removed as is provided in the bp-default theme then you would select that page template for you terms&conditions page and when 1.3 hits you would do the same for the registration page.

  • Profile picture of naijaping naijaping said 1 year ago:

    thanks so much, the above approach worked, Am using a child theme created by me, but i copied all the files from bp-default theme and customised it. where can i get the onecolumn-page.php template? am not developer but its only help from people like that push me this far

    regards

  • Profile picture of Hugo Hugo said 1 year ago:

    Taken from bp-default 1.3:

    <?php
    /*
     * Template Name: One column, no sidebar
     *
     * A custom page template without sidebar.
     *
     * @package BuddyPress
     * @subpackage BP_Default
     * removed since notice hnla
     */
    
    get_header() ?>
    
    	<div id="content">
    		<div class="padder one-column">
    
    		<?php do_action( 'bp_before_blog_page' ) ?>
    
    		<div class="page" id="blog-page" role="main">
    
    			<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    				<h2 class="pagetitle"><?php the_title(); ?></h2>
    
    				<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    
    					<div class="entry">
    
    						<?php the_content( __( '<p class="serif">Read the rest of this page ?</p>', 'buddypress' ) ); ?>
    
    						<?php wp_link_pages( array( 'before' => '<div class="page-link"><p>' . __( '<strong>Pages:</strong> ', 'buddypress' ), 'after' => '</p></div>', 'next_or_number' => 'number')); ?>
    						<?php edit_post_link( __( 'Edit this entry.', 'buddypress' ), '<p class="edit-link">', '</p>'); ?>
    
    					</div>
    
    				</div>
    
    			<?php comments_template(); ?>
    
    			<?php endwhile; endif; ?>
    
    		</div><!-- .page -->
    
    		<?php do_action( 'bp_after_blog_page' ) ?>
    
    		</div><!-- .padder -->
    	</div><!-- #content -->
    
    <?php get_footer(); ?>

    Not sure if this is practical as it is from 1.3 but the principle is sound. You would need to ensure your custom markup – if any – was replicated in this page and change the top template notice to 1..28 this would then give you a selectable template for when you create any pages that don’t require sidebars. When 1.3 lands live you will also be able to use templates for regular BP pages such as registration as 1.3 uses pages for the main components.