stianthaulow
Member
Posted 1 year ago #
I'm using a static page to list all the posts of one category like this:
<?php $posts = get_posts('category=1');
foreach($posts as $post) :
setup_postdata($post); ?>
<div class="post">
<h2><a href="<?php the_permalink(); ?>" id="post-<?php the_ID(); ?>"><?php the_title(); ?></a></h2>
<? the_content(); ?>
<small><?php the_time('F jS, Y') ?></small>
<p class="postmetadata"><?php edit_post_link('Edit', '', ''); ?>
</div>
<?php endforeach; ?>
But the_content() seems to ignore the <!--more--> tags when getting posts this way... All posts are shown in full length...
I am not using a static page but when I insert the <!--more--> tag using the_content it breaks fine. However it does cause other problems. My background color dissapears and my sidebar moves to the bottom of site. Wierd.
stianthaulow
Member
Posted 1 year ago #
Yeah, I forgot to say: the <!--more--> tag works fine when using the_content() in the regular loop on the ordinary posts page (the one using the index.php template from my theme)
It's only when I override the query (after the page is fetched) by using get_posts() and setup_postdata() that the_content() ignores <!--more-->
@JesseG5: check if you've got any html start-tags in your posts, if the <!--more--> comes before the end-tags, it can mess up your site
lordyama
Member
Posted 1 year ago #
Solution at: http://wordpress.org/support/topic/164560
You need to use <?php global $more; $more = 0; the_content(); ?>
analogue40
Member
Posted 5 months ago #
cheers for the tip, took me a few mins before realising
$more = 0; turns more on
$more = 1; turns more off