ethicus
Member
Posted 2 years ago #
Hi there I´ve managed to make a page that loads recent post of different categories. code looks like this:
<?php $recent = new WP_Query("cat=8&showposts=1"); while($recent->have_posts()) : $recent->the_post();?>
<h1><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h1>
<?php the_content('Read more'); ?>
<?php endwhile; ?>
The post with cat id 8 has a more tag in it, but i don't see the read more link in the output can someone help me out on this one?
Try this before the_content
<?php global $more; $more = 0; ?>
ethicus
Member
Posted 2 years ago #
<?php $recent = new WP_Query("cat=8&showposts=1"); while($recent->have_posts()) : $recent->the_post();?>
<h1><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h1>
<?php global $more; $more = 0; ?>
<?php the_content('Read more'); ?>
<?php endwhile; ?>
this don't work...
Hmm; what about:
global $wp_query;
$wp_query->in_the_loop = true;
ethicus
Member
Posted 2 years ago #
Nope that wont do it neither :o(
ethicus
Member
Posted 2 years ago #
I'm sorry i've put in a post that doesn't have the more tag in it DUH!
Could you tell me what the extra code does?
THIS CODE WORKS!
<?php $recent = new WP_Query("cat=5&showposts=1"); while($recent->have_posts()) : $recent->the_post();?>
<h1><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h1>
<?php global $more; $more = 0; ?>
<?php the_content('Read More..'); ?>
<?php endwhile; ?>