私はwordpress
の初心者です。私はすべての方法を試しましたが、テーマをwoocommerce
にすることはできません。以下は、以下の私のwoocommerce.php
ワードプレスのテーマのwoocommerceサポートは動作しません
で、私はpage.php
を複製し、woocommerce.php
を作成し、サーバーにアップロード最初は私のpage.phppage.php
<?php /** * The template for displaying pages * * This is the template that displays all pages by default. * Please note that this is the WordPress construct of pages and that * other "pages" on your WordPress site will use a different template. * */ ?> <?php get_header(); ?> <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12"> <div class="page"> <?php if (have_posts()) : ?> <?php while(have_posts()) : the_post(); ?> <div class="post"> <h3 class="<?php post_class(); ?>" id="post-<?php the_ID(); ?>"><?php the_title(); ?></h3> <div class="entry-content"> <?php the_content(); ?> </div> <?php // If comments are open or we have at least one comment, load up the comment template. if (comments_open() || get_comments_number()) { comments_template(); } ?> </div> <?php endwhile; ?> <?php endif; ?> </div> </div> <?php get_footer(); ?>
ですが、それは失敗します
woocommerce.php
<?php
/**
* The template for displaying pages
*
* This is the template that displays all pages by default.
* Please note that this is the WordPress construct of pages and that
* other "pages" on your WordPress site will use a different template.
*
*/
?>
<?php get_header(); ?>
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="page">
<?php woocommerce_content(); ?>
</div>
</div>
<?php get_footer(); ?>
しかし、この後、私はサーバからwoocommerce.php
を削除し、私のfunctions.php
ファイルを編集して、woocommerceサポートコードを追加しました。以下は私のfunctions.php
ファイルに追加したコードです。
remove_action('woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
remove_action('woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);
add_action('woocommerce_before_main_content', 'my_theme_wrapper_start', 10);
add_action('woocommerce_after_main_content', 'my_theme_wrapper_end', 10);
function my_theme_wrapper_start() {
echo '<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12"><div class="page">';
}
function my_theme_wrapper_end() {
echo '</div></div>';
}
add_action('after_setup_theme', 'woocommerce_support');
function woocommerce_support() {
add_theme_support('woocommerce');
}
が、それはまた失敗し、あなたがデバッガに表示されている場合は、あなたが何woocommerce CSSファイルがロードされていないことを確認することができ、出力here
を見ることができます。
ご意見をお寄せください。ありがとうございました。
カスタムテーマでwoocommerceを統合するためのこのリンクを確認してください:https://docs.woothemes.com/document/template-structure/ –
woocommerceファイルをテーマディレクトリにコピーしてから、woocomerce.phpファイルを作成して貼り付けてくださいpage.phpコードをwoocommerce.phpファイル –
@hardiksolanki私はチェックしましたが、まだ同じです –