have_posts()

Verifikon nëse ka postime për të shfaqur brenda ciklit.

Shembull:

<?php var_dump(have_posts());?>

Rezultati:

bool(true)

Shembull i përdorimit brenda shabllonit:

<?php if (have_posts()): while (have_posts()) : the_post(); ?>
    <!-- article -->
    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
        <?php the_content(); ?>
        <?php comments_template( '', true ); // Remove if you don't want comments ?>
        <br class="clear">
        <?php edit_post_link(); ?>
    </article>
    <!-- /article -->
<?php endwhile; ?>

Referenca

All Rights Reserved Theme by 404 THEME.