Carousel with Wordpress posts

0

Hello, I'm trying to apply OWL-CAROUSEL to a custom post page. When I do in normal HTML, without PHP tags, it works super well, but if I play in the wp_query loop it does not take the plugin and lists the posts one underneath the other.

See the code below:

<div id="owl-demo" class="owl-carousel">

        <?php
            $estrutura = new WP_Query('post_type=estrutura&orderby=post_status&order=DESC&showposts=-1');
            if($estrutura->have_posts()):while($estrutura->have_posts()): $estrutura->the_post();
        ?>

            <div class="item">
                <span>
                    <?php echo get_the_post_thumbnail($page->ID, array(501,301)); ?>
                    <!-- TAMANHO DA IMAGEM DEVE SER 1024x615 -->

                    <h1><?php the_title(); ?></h1>
                </span>

                <div>
                    <?php the_content(); ?>
                </div>
            </div>

        <?php
            endwhile;
            endif;
            wp_reset_postdata();
        ?>

        </div>

How can I solve this problem? Remembering that the scripts are ok, all being called as well as the css's.

Thank you in advance.

    
asked by anonymous 19.03.2015 / 01:12

1 answer

2

The problem is in this line

<?php echo get_the_post_thumbnail($page->ID, array(501,301)); ?>

The correct would be to use the $ post variable that is the global variable for the post.

<?php echo get_the_post_thumbnail($post->ID, array(501,301)); ?>
    
27.03.2015 / 20:20