How do I get_posts from an Archive in WordPress?

  • # June 10, 2013 at 4:40 pm

    So, I successfully can get_posts from categories, but what about archives? I need to say IF < = 5 posts in an archive, get this footer. It works for categories, I just need to get the archive. Keep in mind I'm using archive.php, NOT archives.php. This is the code I used to get posts from a category: < ?php
    $cat = get_query_var(‘cat’);
    $posts = get_posts(array(‘category’ => $cat));

    if(count($posts) >= 5) {
    get_footer( ‘home’ );
    else if(count($posts) < 5){

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.