Ben bir ajax çağrısı için ayrı bir php dosyası üzerinde WP_Query çalıştırmak istiyorum

0 Cevap php

Örneğin:

<?php $numposts = $_POST['showposts']; ?>


<?php $home_query_bottom = new WP_Query("cat=&showposts=$num_posts&offset=5"); $b = 0; ?>
<ul class="thumbs">
    <?php while ($home_query_bottom->have_posts()) : $home_query_bottom->the_post();
        $do_not_duplicate = $post->ID; $b++; ?>

        <li class="post-<?php the_ID(); ?> thumb"><?php get_the_image( array( 'custom_key' => array( 'thumbnail' ), 'default_size' => 'thumbnail', 'width' => '160', 'height' => '160' ) ); ?></li>
    <?php endwhile; wp_reset_query(); $b = 0; ?>
</ul>

Yukarıdaki kod ancak ben WP_Query sınıfı bulunamadı söyleyerek bir hata olsun, kendi php dosyasında ana wordpress sayfa tarafından çağrılacak hazırdır. Ben muhtemelen içeren bir demet HEADER.html kullanarak değilim çünkü bu varsayarak yaşıyorum. Ne WP_Query sınıfını kullanmak için bu sayfanın gerekiyor?

0 Cevap