<?php $loop = new WP_Query(array('post_type'=>'works', 'orderby' => 'post_id', 'order'=>'ASC')) ?>
<?php while($loop->haveposts()): $loop->the_post(); ?>
<?php echo the_post(); ?>
<a href="https:www.mindificent.in" alt="mindificent" target="_blank">
<?php echo the_post(); ?>
<div class="item">
<div class="item-image">
<img src="img/items/item5.png" alt="" />
</div>
<div class="item-text">
<div class="item-text-wrap">
<p class="item-text-category"><?php echo the_title() ?></p>
<h2 class="item-text-title"><?php echo the_field('work_desc') ?></h2>
</div>
</div>
</div>
</a>
// This is the code for displaying custom post
<?php endwhile; ?>
Use this Code
<?php
$args = array('post_type' => 'works', 'post_status' => 'publish', 'orderby' => 'post_id', 'order' => 'ASC');
$loop = new WP_Query( $args );
if( $loop->have_posts() )
{
while ( $loop->have_posts() )
{
$loop->the_post();
?>
<a href="https:www.mindificent.in" alt="mindificent" target="_blank">
<div class="item">
<div class="item-image">
<img src="img/items/item5.png" alt="" />
</div>
<div class="item-text">
<div class="item-text-wrap">
<p class="item-text-category"><?php echo the_title() ?></p>
<h2 class="item-text-title"><?php echo the_field('work_desc') ?></h2>
</div>
</div>
</div>
</a>
<?php
}
}
wp_reset_postdata();
?>
if the_title() function not work then you could try:
<p class="item-text-category"><?php echo get_the_title() ?></p>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.