• Hey gang,

    I’m trying to setup a mobile version for my wordpress-driven site (with slave-tethered mysql databases), and in writing single.php I’ve run into a curious problem:

    <?php the_content(); ?> won’t work!! Excerpt does, and the $post->post_content method works, but without the formatting goodness of the_content. Code’s below.

    Cheers!

    <div id="single">
    	<? $cat = cat_slug(); $do_not_duplicate[] = $post->ID; ?>
                <h3><? the_category(', '); ?> &raquo;</h3>
                <h1><? the_title(); ?></h1>
                <p class="byline"><?php $key="writer"; echo get_post_meta($post->ID, $key, true); ?> | <?php the_time('d M.') ?></p>
                    <div id ="content"><? # echo $post->post_content; ?><?php the_content(); ?></div>
               	<div id="breadcrumbs"><?php echo "Continue Reading:"; wp_link_pages('before=&after=&next_or_number=number&pagelink=%'); ?></div>
    
            </div><!--single-->
Viewing 3 replies - 1 through 3 (of 3 total)
  • I have the same issue with my theme. It’s my first own theme, so I’m probably just stupid, but I really can’t figure out why the_content isn’t working. get_the_content as well. They both work in the loop, but not on my single.php

    single.php:

    <?php get_header(); ?>
    
    <div><?php the_title(); ?></div>
    
    	<div>
    	<?php if (is_single()) {
    	echo $the_content;
    	echo "is_single = true";
    } ?>
    		<? echo $post->post_content; ?>
    	</div>
    
    <div class="main">hehe<?php the_content('Read more...'); ?></div>
    
    <?php get_footer(); ?>
    <?php the_content(); ?>

    @gintonic maybe try <?php instead of <? in your lines of code, not sure but I understand that this can cause problems.

    @j-sir will you post all of the code from your page? Did you see the post’s title coming up but not the content, or can’t you see either?

    I saw the title coming up, and not the content. But I solved it myself… Hadn’t included this part in single.php:
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    Thanks anyway!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘the_content not working…’ is closed to new replies.