troubleshooting Question

bbpress: remove header and footer

Avatar of kyle heier
kyle heier asked on
HTMLPHPjQuery
7 Comments1 Solution1066 ViewsLast Modified:
I am trying to load bbpress via iframe into a wordpress page. I want to simply load the forum content and remove the header, footer, and sidebar.

Within my theme, there is a bbpress.php in which we can modify. I have been able to remove the sidebar, but when I remove the first line of the code:

<?php get_header(); ?>

The forum format goes bye-bye.

Is there a way to contain the format within the bbpress.php file itself so I can remove the header and footer without running into this issue?

Here is the current code:

<?php get_header(); ?>
	
	<div id="content" class="<?php echo $content_class; ?>" style="<?php echo $content_css; ?>">
		<?php
		if(have_posts()): the_post();
		?>
		<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
			<span class="entry-title" style="display: none;"><?php the_title(); ?></span>
			<span class="vcard" style="display: none;"><span class="fn"><?php the_author_posts_link(); ?></span></span>
			<span class="updated" style="display:none;"><?php the_modified_time( 'c' ); ?></span>				
			<?php if( ! post_password_required($post->ID) ): ?>
			<?php if(!$smof_data['featured_images_pages'] && has_post_thumbnail()): ?>
			<div class="image">
				<?php the_post_thumbnail('blog-large'); ?>
			</div>
			<?php endif; ?>
			<?php endif; // password check ?>
			<div class="post-content">
				<?php the_content(); ?>
				<?php wp_link_pages(); ?>
			</div>
			<?php if( ! post_password_required($post->ID) ): ?>
			<?php if(class_exists('Woocommerce')): ?>
			<?php if($smof_data['comments_pages'] && !is_cart() && !is_checkout() && !is_account_page() && !is_page(get_option('woocommerce_thanks_page_id'))): ?>
				<?php
				wp_reset_query();
				comments_template();
				?>
			<?php endif; ?>
			<?php else: ?>
			<?php if($smof_data['comments_pages']): ?>
				<?php
				wp_reset_query();
				comments_template();
				?>
			<?php endif; ?>
			<?php endif; ?>
			<?php endif; // password check ?>
		</div>
		<?php endif; ?>
	</div>
	<?php if( $sidebar_exists == true ): ?>
	<?php wp_reset_query(); ?>
	<div id="sidebar" style="<?php echo $sidebar_css; ?>">
	<?php
	wp_reset_query();
	if(get_post_type() == 'forum') {
		$id_for_sidebar = bbp_get_forum_id();
	} elseif(get_post_type() == 'topic') {
		$id_for_sidebar = bbp_get_topic_id();
	} else {
		$id_for_sidebar = '';
	}
	$name = get_post_meta($id_for_sidebar, 'sbg_selected_sidebar_replacement', true);
	if( isset($name) && 
		$name && 
		$name[0] != '0' &&
		( $smof_data['bbpress_global_sidebar'] && $name[0] != 'Blog Sidebar' )
	) {
		generated_dynamic_sidebar($name[0]);
	} else {
		if ($smof_data['bbpress_global_sidebar'] && $smof_data['ppbress_sidebar'] != "None") {
			generated_dynamic_sidebar($smof_data['ppbress_sidebar']);
		} else if(!$smof_data['bbpress_global_sidebar']) {
			generated_dynamic_sidebar();
		}
	}
	?>
	</div>
	<?php endif; ?>
<?php get_footer(); ?>
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros