• the_title(), the_excerpt(), etc work just fine, but I can’t get the content to display.

    <!-- if front page, display front page articles only -->
    	<?php if (is_home()) :
    	 $myposts = get_posts('numberposts=1&category=19');
    	 foreach($myposts as $post) : setup_postdata($post); ?>
    		<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    		<?php the_content();
    	endforeach; ?>
    
    <!-- if not the front page, do the following -->
    <?php else : ?>
     ...

    I thought adding setup_postdata() would solve the problem, but it doesn’t seem to.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘the_content() doesn’t work even though using setup_postdata()’ is closed to new replies.