The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End How do I get_posts from an Archive in WordPress?

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
  • #45427

    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: $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)
  • The forum ‘Back End’ is closed to new topics and replies.