Hiding Posts from “Recent Posts” Section

  • Unknown's avatar

    Hi,
    I want to hid couple of articles from the Recent Posts section. Not from unregistered users, from everyone. I’ve a separate section for those so don’t want to duplicate. And I’ve a separate category for those articles, say “Special Category” and the ID of that Category is 2. Now how can I do the following? I have:

    1. Article 1
    1. Article 2
    1. Article 3
    1. Article 4
    1. Article 5

    Say for example I want to hide article 2 & 3, which are in “Special Category”. Is it possible? If so then how? Please help.

    Regards.

  • Unknown's avatar

    There isn’t any way to exclude posts from that widget except by making them private, which would mean they would only be viewable by you when you are logged in.

    Alternately, you could password protect them, which would block them from viewers who did not have the password, but they would still show up in the recent posts widget.

  • Unknown's avatar

    Thank you very much for the reply. Now, I am not talking the WordPress.org blog. I have a blog website where I use WordPress like everyone else. So I’ve PHP & MySQL access to all the modules as you know. Is there anyway in the code I can do that? Can I modify the code for displaying “Recent Posts” to avoid displaying say any posts under category ID = 2?

    Thanks in advance.

  • Unknown's avatar

    If you are self-hosted, then you need to inquire over at http://wordpress.ORG/support/ . We have no access to the underlying files, so we cannot help you.

    WordPress.COM is a free-hosting service and uses a different, and highly modified version of the software. This link explains the differences: https://en.forums.wordpress.com/topic/please-read-me-first-before-posting?replies=1

  • Unknown's avatar

    Ok. Thank you very very much for pointing that out..didn’t realize that’s the case…thanks a lot for your help mate. Cheers.

  • Unknown's avatar

    You’re very welcome.

  • Unknown's avatar

    Got it working..thought of sharing it here just in case someone needs it…

    here it is. Instead of this:

    <?php wp_get_archives(‘type=postbypost&limit=15’); ?>

    You’ve to do this:

    <span class=”recentposttitle”><?php _e(‘Recent Entries’,’sh’);?></span>

      <?php $recent = new WP_Query(“showposts=15&cat=-2”); while($recent->have_posts()) : $recent->the_post();?>

    • “><?php the_title(); ?>
    • <?php endwhile; ?>

    cat=-2, where 2 is the category ID i don’t want to display my posts for.

    Thanks a lot.

    http://www.iphonewiki.com.au/

  • Unknown's avatar

    @techreviewau,

    Since we do not have access to the underlying php files here at wordpress.COM, it will not do us any good.

    I am glad that you got it working though.

  • The topic ‘Hiding Posts from “Recent Posts” Section’ is closed to new replies.