Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

sweebee on "Get posts with if and else"

$
0
0

I have the following code

<?php

$args = array( 'posts_per_page' => -1,'post_status' => 'future','order' => 'ASC', 'offset'=> 0, 'post_type' => 'special' );

$myposts = get_posts( $args );
foreach ( $myposts as $post ) : setup_postdata( $post ); ?>

then the post data etc. and after that

<?php endforeach;
wp_reset_postdata();?>

But if there are no posts there must be placed something else like there are no posts available.

Tried a lot of possibilities but no one worked.


Viewing all articles
Browse latest Browse all 8245

Trending Articles