Farhan,这个应该可以,加一个else 到if 声明:
$args = [
    \'post_type\' => \'post\',
    \'posts_per_page\' => 1000
];
$q = new WP_Query($args);
if ( $q->have_posts() ) {
    while ( $q->have_posts() ) {
        $q->the_post();
        ?>
        <p>The posts styling goes here</p>
        <?php
    }
    // cleanup after the query
    wp_reset_postdata();
} else {
    ?>
    <p>Content I want to show if no posts found.</p>
    <?php
    // You could load a sub-template/partial here, e.g.:
    // get_template_part( \'content\', \'none\' );
    // it won\'t replace the entire template though
}