I’m having a problem displaying my custom post type in a WP_query loop, under my post thumbnail image I keep seeing signs (“>) like I’m not closing the tags properly. Also under that image my first custom field where I show a price is not showing at all, but I know it’s there and it works properly, if I use “highlight_string(“”);” I see the price value.

This is the loop:

                       <?php

                            $args = array(
                                    "post_type" => "piso"
                            );
                            $the_query = new WP_Query( $args );

                        ?>

                        <?php if( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>


                            <div class="pisos-grid-item-wrap <?php $comprar_alquilar ?>">

                                <a href="<?php the_permalink(); ?>"> 

                                     <img src="<?php the_post_thumbnail( 'post-thumbnail', array('width'=>'270')  ); ?>">

                                </a>

                                <h1> <?php echo $precio ?> € </h1>
                                <h2> <?php the_title(); ?> </h2>
                                <h3> <?php echo $donde ?> </h3>

                            </div>

                        <?php endwhile; endif; ?> 

Also, this is probably worth a new question, but is there an easy way to add a custom field as a class of my main post wrap?

Read more here: Custom Post type loop with ACF not displaying properly


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: