In_category inside mini loop
-
I’m usind in_category inside get_posts on my sidebar. But some wordpress tags(the_permalink and the_title) appear first than the html code
The PHP code
<?php $posts = get_posts('numberposts=10&offset=1'); foreach($posts as $post) : setup_postdata($post); ?> <?php if ( in_category(5) ) { echo '<li><a href="'.the_permalink().'"><b>'.<em>the_title()</em>.'</b></a>'; } else { echo 'not category 5'; } ?> <?php endforeach; ?>
The result is like this
//localhost/wordpress/?p=31Gamurize <ahref=""><b></b></a>
And should be like this
<a href="//localhost/wordpress/?p=31"><b>Gamurize</b></a>
Why is this happening???
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘In_category inside mini loop’ is closed to new replies.