- This topic has 5 replies, 2 voices, and was last updated 8 years, 11 months ago by Tom.
-
AuthorPosts
-
October 20, 2014 at 12:57 am #40444Manny
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
MannyOctober 20, 2014 at 10:53 am #40503TomLead DeveloperLead DeveloperHi Manny, thanks for the code ๐
Does the above code work well for you?
October 25, 2014 at 9:27 am #41718MannyHello 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.
October 25, 2014 at 11:38 pm #41782TomLead DeveloperLead DeveloperAwesome – 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!
November 9, 2015 at 3:09 am #151506K PeschmannI’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’ => ‘<span class=”page-links-title”>’ . __( ‘Pages:’, ‘twentythirteen’ ) . ‘</span>’, ‘after’ => ‘‘, ‘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(); ?>November 9, 2015 at 10:31 am #151586TomLead DeveloperLead DeveloperHi 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
-
AuthorPosts
- You must be logged in to reply to this topic.