• Hello!

    I have a static main page where I also display the last five recent posts. I want to exclude specific categories from this list.

    This is the code I’m currently using:

    <?php
    $args = array(
      'numberposts' => 1,
      'cat' => journal
      );
    $posts=get_posts($args);
    if ($posts) {
    foreach($posts as $post) {
    setup_postdata($post);
    ?>
    <p><a>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
    <h3 class="entry-title"></a><a>" title="<?php printf(__('Permalink to %s', 'veryplaintxt'), wp_specialchars(get_the_title(), 1)) ?>" rel="bookmark"><?php the_title() ?></a></h3>
    <div class="entry-date"><abbr class="published" title="<?php the_time('Y-m-d\TH:i:sO'); ?>"><?php unset($previousday); printf(__('%1$s', 'veryplaintxt'), the_date('j F, Y', false)) ?></abbr></div><?php the_content(); ?>
    <p>
    —<?php veryplaintxt_author_hCard(); ?>
    <?php }
    }
    ?>

    It might be pretty messy, I don’t know. Where should I change/add the information to exclude a specific category from appearing?

    Or if someone is bored/kind enough to clean up what is probably an egregious block of code, I would be most appreciative. Thank you, WordPress community.

    I love you all.

Viewing 1 replies (of 1 total)
  • Thread Starter octonaut

    (@octonaut)

    Mods: Please delete! I put in the wrong code and am not able to edit my post any further. I started a new thread with the right code. Thank you!

Viewing 1 replies (of 1 total)
  • The topic ‘Display recent posts excluding certain categories’ is closed to new replies.