• ohdear

    (@ohdear)


    I’m currently using get_posts – http://wiki.wordpress.org/?pagename=get_posts to get a list of recent posts on my Retrospotive theme and it works fine except when someone only has one published post, as I’ve set the offset to 1.

    I was wondering if there a simple if statement that I could add, so the list doesn’t display unless there’s more than 1 published post? PHP unfortunately isn’t my strong point, so any help would be much appreciated 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • ifelse

    (@ifelse)

    [Removed by IfElse] Alphaoide’s little snippet is actually closer to what you’re looking for.

    Joshua Sigar

    (@alphaoide)

    or try the following

    $posts = get_posts();
    if( $posts ) {
    // foreach posts do something
    }

    Thread Starter ohdear

    (@ohdear)

    Thank you so much to both of you 😀

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Detect more than 1 published post?’ is closed to new replies.