Forums

cat=x string in post query causes frontpage to go blank!! (6 posts)

  1. dttn
    Member
    Posted 3 years ago #

    I just upgraded to 2.7 from 2.6.5 and cannot load the index because of the cat=1 string in this code.

    <?php query_posts('cat=1&showposts=2'); ?>

    The frontpage is just blank. no errors or anything. Other pages work because it does not have the query. When I remove cat=1, the frontpage loads fine but I need to exclude every other category except cat 1 on the frontpage.

    I've tried deactivating all plugins but the problem still exist.

    Anyway to fix this?

    Thanks.

  2. tiagosartor
    Member
    Posted 3 years ago #

    I have exactly the same issue and am waiting for a solution as well.

  3. MichaelH
    Volunteer
    Posted 3 years ago #

  4. dttn
    Member
    Posted 3 years ago #

    Yes seems like the problem in the ticket is the same as mine

  5. dttn
    Member
    Posted 3 years ago #

    No fix yet but this plugin did the job for me.
    http://wordpress.org/extend/plugins/simply-exclude/

  6. enailor
    Member
    Posted 3 years ago #

    I found this same problem, but have found an alternative that works!

    As we have seen, using the following code does not work:
    <?php query_posts('cat=1&showposts=2'); ?>

    However, after a ton of google searching, I found an alternative that seems to work:

    <?php $my_query = new WP_Query("cat=3&showposts=10");
      while ($my_query->have_posts()) : $mt_query->the_post(); ?>

    Continue the loop here...

    Hope that helps!
    Ed

Topic Closed

This topic has been closed to new replies.

About this Topic