Cyber Week Sale! Get $20 off GP Premium, $40 off our new Lifetime license, and 45% off license renewals/extensions! Learn more

[Resolved] BuddyPress Docs Removing Sidebar

Home Forums Support BuddyPress Docs Removing Sidebar

  • This topic has 5 replies, 2 voices, and was last updated 5 years ago by Tom.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #40444
    Manny

    In case it helps another I am posting my code which hides the sidebar whilst on a BuddyPress Docs page. The file we update is the page.php file. Obviously we’ll want to update the page.php page within our child theme else our edits will disappear upon an update. If you know of a better, more efficient way. Please let me know. Thank you.

    get_header(); ?>
    
    <?php if ( 'bp_doc' == get_post_type() || is_post_type_archive( 'bp_doc' )  ) : ?>
    
    	<div id="primary">
    
    <?php else : ?>
    
    	<div id="primary" <?php generate_content_class();?>>
      
    <?php endif; ?>
    
    		<main id="main" <?php generate_main_class(); ?> itemprop="mainContentOfPage" role="main">
    			<?php do_action('generate_before_main_content'); ?>
    			<?php while ( have_posts() ) : the_post(); ?>
    
    				<?php get_template_part( 'content', 'page' ); ?>
    
    				<?php
    					// If comments are open or we have at least one comment, load up the comment template
    					if ( comments_open() || '0' != get_comments_number() )
    						comments_template();
    				?>
    
    			<?php endwhile; // end of the loop. ?>
    			<?php do_action('generate_after_main_content'); ?>
    		</main><!-- #main -->
    	</div><!-- #primary -->
    
    <?php if ( 'bp_doc' == get_post_type() || is_post_type_archive( 'bp_doc' )  ) :
    
    	//no sidebars -->
    
    else :
    
    do_action('generate_sidebars');
      
    endif;
    
    get_footer();
    

    Sincerely
    Manny

    #40503
    Tom
    Lead Developer
    Lead Developer

    Hi Manny, thanks for the code 🙂

    Does the above code work well for you?

    #41718
    Manny

    Hello Tom.

    Indeed the code works well thanks to your having coded such a great template.

    I am sure the code I provided can be written in a much more efficient manner or method. However, it does work as intended and I haven’t seen any issues. Been using it almost a week now.

    #41782
    Tom
    Lead Developer
    Lead Developer

    Awesome – looks good to me 🙂

    Just be sure to look at the page.php template once in a while in case I’ve added something important in there – most likely won’t happen, but worth a look every now and then.

    Thanks!

    #151506
    K Peschmann

    I’m struggling to get this to work with my theme Plain Jayne which is a child of Twenty Thirteen, my page.php looks like the below and there is no page.php within the child theme.

    <?php
    /**
    * The template for displaying all pages
    *
    * This is the template that displays all pages by default.
    * Please note that this is the WordPress construct of pages and that other
    * ‘pages’ on your WordPress site will use a different template.
    *
    * @package WordPress
    * @subpackage Twenty_Thirteen
    * @since Twenty Thirteen 1.0
    */

    get_header(); ?>

    <?php /* The loop */ ?>
    <?php while ( have_posts() ) : the_post(); ?>

    <article id=”post-<?php the_ID(); ?>” <?php post_class(); ?>>
    <header class=”entry-header”>
    <?php if ( has_post_thumbnail() && ! post_password_required() ) : ?>

    <?php the_post_thumbnail(); ?>

    <?php endif; ?>

    <h1 class=”entry-title”><?php the_title(); ?></h1>
    </header><!– .entry-header –>

    <?php the_content(); ?>
    <?php wp_link_pages( array( ‘before’ => ‘

    ‘, ‘link_before’ => ‘<span>’, ‘link_after’ => ‘</span>’ ) ); ?>

    <!– .entry-content –>

    <footer class=”entry-meta”>
    <?php edit_post_link( __( ‘Edit’, ‘twentythirteen’ ), ‘<span class=”edit-link”>’, ‘</span>’ ); ?>
    </footer><!– .entry-meta –>
    </article><!– #post –>

    <?php comments_template(); ?>
    <?php endwhile; ?>

    <!– #content –>

    <!– #primary –>

    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    #151586
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    I’m afraid supporting other themes is a little out of the scope of these forums.

    You can try posting your question in the Twenty Thirteen support forum: https://wordpress.org/support/theme/twentythirteen

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.