1

少し問題があり、それについて何も見つけることができませんでした...私はデッドロックに陥っています。

したがって、通常のループを含む wp ページを作成しました。このファイルをブラウザで直接呼び出すと、すべて正常に動作し、 http ://domain.com/blog/wp-content/themes/ などのクエリ変数を使用することもできます。wovies-bones/getmovies.php?actor=xそしてそれは正常に動作し、カスタム分類アクター = x を持つ単一の投稿を取得します。

しかし、ajaxを使用して同じものをロードしようとすると、動作が異なり、getリクエストを無視するとすべての投稿が返されます...

何が起こっているのですか?

ajax-jquery 部分:

$.ajax({
  url: templatePath + "getmovies.php",
  type: "GET",
  data: filters_get,
  cache: false,
  success: function (data){
    console.dir(data);
  }
});

そしてphp部分:

    /* Define these, So that WP functions work inside this file */
    define('WP_USE_THEMES', false);
    require('../../../wp-blog-header.php');


?>






    <div id="container">
        <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
        <div class="movie">
            <a href="<?php the_permalink() ?>">
                <?php
                    if (has_post_thumbnail()) {the_post_thumbnail('homepage-preview');}
                    else {echo '<img src="' . get_bloginfo( 'stylesheet_directory' ) . '/images/default-poster.jpg" />';}
                ?>
                <p class="comments"><?php comments_number('0 review','1 review','% reviews'); ?></p>
                <div class="description">
                    <h2><?php the_title(); ?></h2>
                    <?php the_excerpt(); ?>
                </div>
            </a>
        </div>
        <?php endwhile; else: ?>
            <!-- No movies found -->
        <?php endif; ?>
    </div><!-- End #container -->

filters_get は次のようになります: ?actor=x&

4

1 に答える 1