0

I have a custom post type created with Pods plugin labelled "Camere" plural and "Camera" singular.

I placed in my page this loop but nothing shows up. Not even the the text in the anchor tag. if I change the name of the post type to the singular label the browser doesn't render also the code after the loop (div "servizi")

<section class="small">
<h2>Le Nostre Camere</h2>
<div class="intro">
<?php echo do_shortcode('[pods field="intro_camere"]'); ?> 
</div>
<div class="lista_camere">
    <div class="lista_camere_item">
        <?php
            $args = array(
                'post_type' => 'Camere',
                'posts_per_page' => 3
            );
            $camere = new WP_Query( $args ); 

        if ( $camere->have_posts() ) : 

        while ( $camere->have_posts() ) : $camere->the_post(); ?>
            <div class="thumb">
                <?php the_thumbnail(); ?>
                </div>
                <h3><?php the_title(); ?></h3>
                <?php the_excerpt(); ?>
                <a href="<?php the_permalink(); ?>" class="button">Scopri di più</a>

            <?php endwhile; ?>

            <?php wp_reset_postdata(); ?>

            <?php endif; ?>
    </div>
</div>
<div class="servizi">
    <h2>Servizi</h2>
    <div class="lista_servizi">
    <?php echo pods_field_display( 'servizio' ); ?>
    </div>
</div>

I can't find what's wrong and my brain is melting lol

Michel
  • 41
  • 4
  • 2
    Are you 100% sure that the custom post type slug is `Camere`? – cabrerahector Apr 05 '22 at 16:42
  • 1
    There is no issue in your code, if you're sure the post type you registered is `Camera` then try to print the results after WP_Query like this: `print_r($camere);` – Muhammad Ahmad Apr 05 '22 at 17:17
  • Good call, it was wrong because I was using the label of the post instead of the "name" which is camera. I tried it before posting my question but it didn't work because I was also using the incorrect tag `the_thumbnail();` instead of `the_post_thumbnail();` I didn't even get any error messages showing up because I placed it inside the `src` of an ``. removing the `` tag and using the correct post_type I got the error message and resolved it. Thank you for the heads up! – Michel Apr 05 '22 at 17:32

0 Answers0