I make sticky post for my archive page for custom post type with ACF field and loop is not working

Question

I make sticky post for my archive page for custom post type with ACF field and loop is not working

 while($query->have_posts() ){
            $query->the_post();
            $sticky = get_field('sticky', $query->ID);
            ?>
             <?php   if( $sticky ) { ?>
                <div class="trip-item">
                     <h2 class="title-yellow mb-5"><a class="title-yellow" href="<?php  echo get_permalink(); ?>"><?php echo get_the_title(); ?></a></h2>
                    <div class="trip-content">
                        <?php if ( has_post_thumbnail()) : ?>
                        <a class="trip-img-wrap" href="<?php the_permalink(); ?>" alt="<?php the_title_attribute(); ?>">
                            <?php the_post_thumbnail('full', array('class' => 'trip-img')); ?>
                        </a>
                        <?php endif; ?>

                        <div class="trip-txt">
                            <?php $excerpt = wp_trim_words( get_the_content(), 65, '<a class="link-more" href="'.get_the_permalink().'">See more</a>');
                                echo $excerpt;
                            ?>
                            <?php //the_content( 'Read more', 'class="link-more"' ); ?>
                        </div>
                    </div>

                </div>
             <?php }; ?> 
        <?php }; ?> 
        <?php wp_reset_postdata(); ?>

0
Maro Pinčević 2 months 2023-01-27T04:19:35-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse