到目前为止,我有一个非常基本的主题,那就是完美地运行WooCommerce。在我的功能中。php我已设置以下内容以支持woocommerce
.
//
// WooCommerce Hooks and Theme Overrides
//
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\', \'cm_theme_wrapper_start\', 10);
add_action(\'woocommerce_after_main_content\', \'cm_theme_wrapper_end\', 10);
function cm_theme_wrapper_start() {
echo \'
<div class="main-content-wrapper">
<section class="layout-standard">
<section class="cards">
<div class="layout-gallery short">
<div class="background"></div>
<img class="background-image" src="\'; if ( has_post_thumbnail() ) { the_post_thumbnail_url(\'header-bg\'); } else { echo get_template_directory_uri().\'/images/default.jpg\'; } echo \'" alt="\'; $image_title = get_post(get_post_thumbnail_id())->post_title; echo $image_title; echo \'" title="\'; $image_title = get_post(get_post_thumbnail_id())->post_title; echo $image_title; echo \'">
<div class="width-container">
<div class="inner-container">
<h1 class="section-title">\'; woocommerce_page_title(); echo \'</h1>
</div>
</div>
</div>
</section>
<div class="width-container">
<div class="content-container">
<div class="content-holder">\';
}
function cm_theme_wrapper_end() {
echo \'
</div>
</div>
</div>
<div class="sidebar-container">\';
get_sidebar();
echo \'
</div>
</section>
</div>\';
}
这很好,但是在商店主页上,它没有显示页面的特色图像。然而,它显示的是最后一个产品图像。这基本上是一个归档页面,但我想在WordPress之外。How can I get the featured image of the base shop page to show instead of the last product image?