query_posts() from a particular category overriding Page title (4 posts)

  1. eddywebs
    Posted 5 years ago #

    Okay so I had been trying to display posts from a particular category at home page using query_posts() functions at the home page at freespywaredeleter.net.

    However seems like calling this function is overriding the Page title.
    It displays the category title instead of what is set as Homepage title.

    The code used is:

    <?php query_posts('cat=5&showposts=5'); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
      <li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a>
    <?php endwhile; endif; ?>
  2. sparklogix
    Posted 5 years ago #

    I'm having this exact same problem. Not even the All-In-One-SEO plugin will override the title. Anyone know a fix for this?

  3. esmi
    Forum Moderator
    Posted 5 years ago #

    Don't use query_posts. Use get_posts or WP_Query.

  4. sparklogix
    Posted 5 years ago #

    Thanks :)

Topic Closed

This topic has been closed to new replies.

About this Topic