私はwoocommerceの検索結果に問題があります。問題は、「結果が表示されない」ページが表示されないことです。私が知っている何かを検索すると、結果は得られません。すべての製品をダンプします。例:私の子供のテーマでhttp://alpha.safetyworks.com/?s=fkjakfjalkfjdlkjfalkjflkaj%3Blkajfd&post_type=product&tags=0&limit=10&ixwps=1WooCommerceの検索結果が機能しない
が、私はwoocommerce.phpと呼ばれるファイルやコードを持っているが、次のようになります - 1「have_posts()」ここからそう
<?php get_header();
$bloglayout = neat_get_blog_layout();
?>
<div class="blog-single">
<div class="container">
<?php if($bloglayout == 'l_sidebar'):?><?php get_sidebar();?><?php endif;?>
<div class="main-column">
<?php
// get the post.
if(have_posts()):
// loop the post.
woocommerce_content();
else:
// nothing found.
get_template_part('content', 'none');
endif;
?>
<?php
/**
* neat_pagination action.
* hooked neat_pagination, 10
*/
do_action('neat_pagination');
?>
</div>
<?php if($bloglayout == 'r_sidebar'):?><?php get_sidebar();?><?php endif;?>
</div>
</div>
<?php get_footer();?>
、私は2つのことを伝えることができます関数が正常に動作していないか、または関数woocommerce_content()が機能していません。
woocommerce_content()WC-テンプレートのfunctions.phpに住んでいるとそれが
if (! function_exists('woocommerce_content')) {
/**
* Output WooCommerce content.
*
* This function is only used in the optional 'woocommerce.php' template.
* which people can add to their themes to add basic woocommerce support.
* without hooks or modifying core templates.
*
*/
function woocommerce_content() {
if (is_singular('product')) {
while (have_posts()) : the_post();
wc_get_template_part('content', 'single-product');
endwhile;
} else { ?>
<?php if (apply_filters('woocommerce_show_page_title', true)) : ?>
<h1 class="page-title"><?php woocommerce_page_title(); ?></h1>
<?php endif; ?>
<?php do_action('woocommerce_archive_description'); ?>
<?php if (have_posts()) : ?>
<?php do_action('woocommerce_before_shop_loop'); ?>
<?php woocommerce_product_loop_start(); ?>
<?php woocommerce_product_subcategories(); ?>
<?php while (have_posts()) : the_post(); ?>
<?php wc_get_template_part('content', 'product'); ?>
<?php endwhile; // end of the loop. ?>
<?php woocommerce_product_loop_end(); ?>
<?php do_action('woocommerce_after_shop_loop'); ?>
<?php elseif (! woocommerce_product_subcategories(array('before' => woocommerce_product_loop_start(false), 'after' => woocommerce_product_loop_end(false)))) : ?>
<?php wc_get_template('loop/no-products-found.php'); ?>
<?php endif;
}
}
}
woocommerce.phpは検索結果を生成しません。あなたの子供のテーマは 'search.php'を持っている必要があります – RobBenz
それは私が思ったことですが、search.phpとsearchform.phpを親と子のテーマから(テストするために)削除したのでそうではありません。 woocommerce.phpを削除すると、検索に失敗します。エラーページ。 – timrosenthal
あなたのテーマは、woocommerceのサポートを提供していますか?あなたが追加したものですか?あなたの子供のテーマsearch.phpはどのように見えましたか? '<?php if(have_posts()):while(have_posts()):the_post();のようなものですか? wc_get_template_part( 'content'、 'product');終わり。 ?> '' <?php else:wp_redirect(get_bloginfo( 'siteurl')。 '/ 404'、404);出口; endif; ?> ' – RobBenz