Wordpress 商业循环标题位置

Wordpress 商业循环标题位置,wordpress,woocommerce,Wordpress,Woocommerce,在店面顶部构建自定义商业模板 我想在分类页面的循环功能中替换/更改单个项目标题的一些html。“添加到购物车”链接、价格等都位于woocommerce/templates/loop目录中。该目录中的任何文件都不包含此功能的产品标题的html 我在哪里找到这东西?我发誓,在woocommerce上构建最烦人的事情是试图找到所有片段的位置…woocommerce/includes/wc template functions.php if ( ! function_exists( 'woocommer

在店面顶部构建自定义商业模板

我想在分类页面的循环功能中替换/更改单个项目标题的一些html。“添加到购物车”链接、价格等都位于
woocommerce/templates/loop
目录中。该目录中的任何文件都不包含此功能的产品标题的html


我在哪里找到这东西?我发誓,在woocommerce上构建最烦人的事情是试图找到所有片段的位置…

woocommerce/includes/wc template functions.php

if ( ! function_exists( 'woocommerce_template_loop_product_title' ) ) {

    /**
     * Show the product title in the product loop. By default this is an H2.
     */
    function woocommerce_template_loop_product_title() {
        echo '<h2 class="' . esc_attr( apply_filters( 'woocommerce_product_loop_title_classes', 'woocommerce-loop-product__title' ) ) . '">' . get_the_title() . '</h2>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    }
}
woocommerce\u模板\u循环\u产品\u标题
功能

function woocommerce_template_loop_product_title() {
    echo '<h3 class="woocommerce-loop-product__title">' . get_the_title() . '</h3>';
}
function\u-commerce\u-template\u-loop\u-product\u-title(){
回显“”。获取标题();
}

您需要更改functions.php文件中的信息,最好是主题子文件中的信息。
你放在那里的东西通常会被重写,因为它有优先级。

就像兰迪写的一样,这是一个你可以在中找到的可插入函数

wp-content\plugins\woocommerce\includes\wc-template-functions.php

if ( ! function_exists( 'woocommerce_template_loop_product_title' ) ) {

    /**
     * Show the product title in the product loop. By default this is an H2.
     */
    function woocommerce_template_loop_product_title() {
        echo '<h2 class="' . esc_attr( apply_filters( 'woocommerce_product_loop_title_classes', 'woocommerce-loop-product__title' ) ) . '">' . get_the_title() . '</h2>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    }
}
如果(!function_存在('woocommerce_template_loop_product_title')){
/**
*在产品循环中显示产品标题。默认情况下,这是H2。
*/
函数\u模板\u循环\u产品\u标题(){
echo“”。获取标题()。//phpcs:忽略WordPress.Security.EscapeOutput.OutputNotEscaped
}
}
要覆盖它,只需在子主题的functions.php文件中复制粘贴不带条件的代码,并根据需要进行修改

例:将h2改为h3

function woocommerce_template_loop_product_title() {
   echo '<h3 class="' . esc_attr( apply_filters( 'woocommerce_product_loop_title_classes', 'woocommerce-loop-product__title' ) ) . '">' . get_the_title() . '</h3>'; 
}
function\u-commerce\u-template\u-loop\u-product\u-title(){
回显“”。获取标题();
}