0

検索結果を表示するためのWordPressテンプレートがあります。正常に動作しますが、並べ替え順序を変更したい場合はできません。query_posts が期待どおりに機能しません。結果が表示されません。

ここに私のコードの一部があります:

global $query_string;
query_posts( $query_string . '&order=ASC' );
if (have_posts()) {
     theme_post_wrapper(
                array('content' => '<h4 class="box-title" >'. $count.'</h4>')
        );                                                          

            /* Display navigation to next/previous pages when applicable */
            if (theme_get_option('theme_top_posts_navigation')) {
                theme_page_navigation();
            }

            /* Start the Loop */
            while (have_posts()) {                    
                the_post();                        
                get_template_part('content', 'search');                                                 
            }

            /* Display navigation to next/previous pages when applicable */
            if (theme_get_option('theme_bottom_posts_navigation')) {
                theme_page_navigation();
            }

} else {
            //NO DATA FOUND
}

query_posts を削除すると、結果が表示されます。上記のように query_posts を追加すると、データは表示されません。これは非常に奇妙で、どうすればよいかわかりません。デバッグする方法は? SQLクエリのようなものを取得する方法はありますか? 他の何か?アイデアをください。

また、order または orderby パラメーターを GET パラメーターとして追加しようとしましたが、検索結果には何も起こりませんでした (並べ替えは変更されませんでした)。

4

0 に答える 0