I’m trying to echo the content of a single post by using the_content(); but I get an empty result. However when I directly address the global $post, and specifically the post_content property it does show. What can cause such peculiar behaviour?
CODE: the problematic line is near the end
<?php
get_header(); ?>
<div id="com_page" class="content">
<ul id="com_list">
<?php
$title = get_the_title();
$q = new WP_Query(array(
'post_type'=>'community',
'numberposts'=>-1,
'orderby'=>'title',
'order'=>'asc'));
if ( $q->have_posts() ) : while ( $q->have_posts() ) : $q->the_post(); ?>
<li><a href="https://wordpress.stackexchange.com/questions/77494/<?php the_permalink(); ?>" <?php if ($title==get_the_title()) echo "class=com_sel"; ?> ><?php the_title(); ?></a></li>
<?php endwhile; ?>
<?php endif; ?>
</ul>
<div id="com_content">
<div id="title">
<h1>קהילות צעירות<span> <?php wp_reset_query(); the_post(); the_title(); ?><span></h1>
<?php
$title=get_the_title();
$forum_id = $wpdb->get_row("SELECT id FROM wp_forum_forums WHERE name="$title""); // find forum id
?>
</div><!--title-->
<ul id="com_menu" class=clearfix>
<li><a href="https://wordpress.stackexchange.com/questions/77494/<?php the_permalink(); ?>" <?php if (!isset($_GET['tab'])) {echo "class=com_sel"; $page = "אודות הקבוצה";} ?>>אודות הקבוצה</a></li>
<li><a href="<?php the_permalink(); ?>/?tab=events" <?php if (isset($_GET['tab']) && $_GET['tab']=='events') {echo "class=com_sel"; $page = "ארועים";} ?>>ארועים</a></li>
<li><a href="<?php the_permalink(); ?>/?tab=gallery" <?php if (isset($_GET['tab']) && $_GET['tab']=='gallery') {echo "class=com_sel"; $page = "גלריה";} ?>>גלריה</a></li>
<li><a href="http://localhost/midor/%D7%A4%D7%95%D7%A8%D7%95%D7%9D/?mingleforumaction=viewforum&f=<?php echo $forum_id->id; ?>.0">פורום</a></li>
</ul><!--com_menu-->
<h1><?php echo $page; ?></h1>
<?php if (isset($_GET['tab']) && $_GET['tab']=='events'): ?>
<!-- Events code -->
<?php elseif (isset($_GET['tab']) && $_GET['tab']=='gallery'): ?>
<!-- Gallery code -->
<?php else: ?>
<!-- About code -->
<div id="about_imgs">
<img src="" alt="">
</div>
<div id="about_txt" style="background:red !important;">
<?php the_content(); ?> // not working
<div class="clear"></div>
</div>
<?php endif; ?>
</div><!--com_content-->
</div><!--com_page-->
<?php
get_sidebar();
get_footer();