• I run a promotional website for an actress at helengrace.co.uk, and use WP to power my news and articles sections, with a PHP include so that only posts in the relevant category appear on the relevant page (as opposed to displaying all posts in all categories).

    Unfortunately, this doesn’t seem to be working since I upgraded to 2.5.1 (can’t remember which version I was running before but it was at least a year old). Now all the pages within the WP loop display a “sorry, no posts match your criteria” error message.

    The code is this: `
    <?php
    /* Short and sweet */
    if (!isset($cat)) {
    $cat = “38”;
    define(‘WP_USE_THEMES’, false);`

    The site started running on WP over 3 years ago, before many of WPs current functions existed (built-in themes and pages etc) so I’m well aware it could do with a sprucing up in general. But, until I have time to re-design it, is there any way I can fix it just so that the posts are at least displaying as and where they should be?

Viewing 2 replies - 1 through 2 (of 2 total)
  • That code sounds like something from the time of WP 1.5.x and earlier.

    These might help:
    The_Loop
    TemplateTags/query_posts

    Thread Starter anonymousse

    (@anonymousse)

    Hi,
    Thanks for the help. Unfortunately I’m still having problems. I had a look at the Loop Codex entry and based on what I read tried to modify the code on my Recent News page to solve the problem. I was trying to get it to display only the entries in the Recent News Category, which is category 39, but it doesn’t seem to be working, and I’m still getting the same “Sorry no posts match your criteria” message as before.

    How/where am I going wrong? The code I’ve now got is this:

    <?php
    /* Short and sweet */
    define('WP_USE_THEMES', false);
    require('./wp-blog-header.php');
    include('header.inc'); ?>
    <h1>Latest News</h1>
    <p class="left">
    All the latest news and information on Helen's career...
    
     <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
     <?php if (is_category('39')) continue; ?>
    <div class="post"><h2 id="post-<?php the_id(); ?>"><?php the_title(); ?></h2>
    	   <h3><b> posted on <?php the_date('l jS F Y'); ?></b></h3>
    <div>
    		  <?php the_content(); ?>
    
    </div>
    <div class="feedback">
     <?php wp_link_pages(); ?>
             </div>
    </div>
    <?php endwhile; else: ?>
     Sorry, no posts matched your criteria.
    
     <?php endif; ?>
    <?php posts_nav_link(' :: ',' << previous',' next >> '); ?>
    <?php include('footer.inc'); ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Category excluder no longer working’ is closed to new replies.