Code is causing wrong title to appear
-
I’m having trouble getting the title to show up on my theme.
I’m using the following, which works ok on its own:
<h1><?php the_title(); ?></h1> <div style="clear: both;"></div> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php the_content(__('Keep Reading'));?> <?php endwhile; else: ?> <?php endif; ?>I’ve got this code in a separate column:
<?php $my_query = new WP_Query("showposts=2&cat=9&offset=0"); ?> <?php while ($my_query->have_posts()) : $my_query->the_post(); ?> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> <?php the_excerpt(); ?><?php endwhile; ?>I’ve narrowed down the problem to the following section of the above code:
<?php while ($my_query->have_posts()) : $my_query->the_post(); ?>But I can’t figure out why it’s a problem.
The following page is called ‘Video’, but it is showing the default WP page:
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Code is causing wrong title to appear’ is closed to new replies.