Support » Fixing WordPress » Exclude posts on homepage under certain word/character count

  • I’m working on redoing a radio website that includes newsfeeds. I’m using Rss Poster to pull the news articles into posts and then display links to some of them on the homepage. Sometimes RSS poster does not pull the full article and just has in the content:
    ABC News Radio … … Article source:
    Is there a way I can exclude these from the posts I’m pulling using either under a certain word count or character count? Below’s the code I use to pull the first posts in each category. The current site I’m working on is

    [please use the ‘code’ button to mark any code posted directly; for codes longer than 10 lines, please use the pastebin]

    <?php $args=array(
          'category_name' => national_news,
          'showposts' => 1,
        $my_query = new WP_Query($args);
        if( $my_query->have_posts() ) {
          while ($my_query->have_posts()) : $my_query->the_post(); ?>
            <div class="newsheader">
    National News</div>
    <ul id="topnews">
    <li><h3><a>"><?php the_title(); ?></a></h3>
    <p><?php getImage('1'); ?><?php the_excerpt(); ?>
           <?php endwhile; } //if ($my_query)
      wp_reset_query();  // Restore global post data stomped by the_post().

    Thanks so much!

  • The topic ‘Exclude posts on homepage under certain word/character count’ is closed to new replies.