duandongji2231 2019-04-22 12:00
浏览 46

如何修复wordpress标签的重复

in woocommerce Single Product pages, i have moved the tabs at the bottom of the page to the opposite side of the main image. i have also turned short description into a tab too.

the problem that persists is that the tabs are duplicated and still show up in the original place. how do i stop this and just make them appear opposite to the image. also i am using a plugin called ppom and i would like that to still appear in its original place which is under the normal position of the tabs.

The code I have used to move the tabs to the right of the image is:

function new_woocommmerce_ppom_price() {
  wp_enqueue_script( 'ppom-price', PPOM_URL.'/js/ppom-price.js', array('jquery','ppom-inputs'), PPOM_DB_VERSION, false);
  wp_enqueue_script('new_woocommerce_ppom_price', get_stylesheet_directory_uri(). '/woocommerce-product-addon/js/new_woocommerce_ppom_price.js', array('jquery','ppom-inputs'), PPOM_DB_VERSION, true);
}
add_action( 'wp_enqueue_scripts', 'new_woocommmerce_ppom_price',50);

remove_action( 'woocommerce_single_product_summary','woocommerce_template_single_add_to_cart', 30 );
add_action( 'woocommerce_after_single_product_summary','woocommerce_template_single_add_to_cart', 30 );

// Add short description to a custom product tab
add_filter( 'woocommerce_product_tabs', 'add_custom_product_tab', 10, 1 );
function add_custom_product_tab( $tabs ) {

    $custom_tab = array(
        'custom_tab' =>  array(
            'title' => __( "Short description", "woocommerce" ),
            'priority' => 10,
            'callback' => 'short_description_tab_content'
        )
    );
    return array_merge( $custom_tab, $tabs );
}

// Custom product tab content
function short_description_tab_content() {
    global $post, $product;

    $short_description = apply_filters( 'woocommerce_short_description', $post->post_excerpt );

    if ( ! $short_description ) {
        return;
    }

    echo '<div class="woocommerce-product-details__short-description">' . $short_description . '</div>'; // WPCS: XSS ok.
}

// Remove short description
// 
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_output_product_data_tabs', 30 );
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 多址通信方式的抗噪声性能和系统容量对比
    • ¥15 winform的chart曲线生成时有凸起
    • ¥15 msix packaging tool打包问题
    • ¥15 finalshell节点的搭建代码和那个端口代码教程
    • ¥15 用hfss做微带贴片阵列天线的时候分析设置有问题
    • ¥15 Centos / PETSc / PETGEM
    • ¥15 centos7.9 IPv6端口telnet和端口监控问题
    • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
    • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
    • ¥20 海浪数据 南海地区海况数据,波浪数据