0
I created a custom post type
and in it 4 posts, and called right in the code, I believe, only that they only appear when I leave some post created in post
type
Posts
which is the standard of Wordpress.
<div class="all-recipe" >
<div class="container-fluid">
<div class="row">
<?php
$args = array(
'post_type' => 'posts_blog',
'status' => 'publish',
'numberposts' => 4,
'order' => 'DESC',
);
$query = get_posts( $args );
?>
<?php if (have_posts()) : foreach( $query as $post ) : setup_postdata ( $post ); ?>
<div class="col-md-3" style="padding: 0;">
<div class="recipe-posts-principais" style="background: url(<?php echo get_the_post_thumbnail_url(); ?>)">
<button>Click to fade in boxes</button><br><br>
<div class="block-infos" style="display: none">
<h1><?php the_title(); ?></h1>
<h3><?php the_author_posts_link(); ?></h3>
<span><?php the_time("d/m/Y"); ?></span>
<h1> <?php echo $meta['mensagem'][0]; ?> </h1>
<p> <?php echo $meta['descricao-humanidade'][0]; ?> </p>
<a href=" <?php the_permalink(); ?>">Saiba mais</a>
</div>
</div>
</div>
<?php endforeach; endif; ?>
</div>
</div>
</div>
Probably the have_posts() function checks for Post type records.
– André
How do I pull only the custom post type I created?
– Peter Roberto