Categories

有特色的模板

WooCommerce. 如何管理产品页面上的选项卡

Lana Greene July 13, 2015
Rating: 5.0/5. From 2 votes.
Please wait...

本教程将向您展示如何管理Woocommerce产品页面上的选项卡.

WooCommerce. 如何管理产品页面上的选项卡

在产品页面上,你通常可以找到标签. 为了编辑现有的选项卡,您可以单击 编辑产品 button:

WooCommerce.-How-to-manage-tabs-on-the-product-page-1

Description tab 显示在产品内容部分设置的产品描述;

Video tab 是在…的帮助下设置的 Custom Field 叫做视频链接-你可以在自定义字段块中找到它;

Reviews tab 显示评论-你可以很容易地找到和管理他们在产品页面的底部 dashboard:

WooCommerce.-How-to-manage-tabs-on-the-product-page-2

以便添加新的 tab,你应该做到以下几点:

  1. 到达服务器上的文件 FTP or hosting cPanel file manager;

  2. Open custom-function.php 文件位于 wp-content / themex themeXXX /包括 folder;

  3. 将以下代码添加到文件底部,就在结束PHP标记之前:

     Add_filter ('woocommerce_product_tabs', 'woo_new_product_tab');
    			函数woo_new_product_tab($tabs) {
    			
    			//添加新选项卡
    			
    			$tabs['test_tab'] = array(
    			'title'        => __( 'New Product Tab', 'woocommerce' ),
    			'priority'     => 50,
    			'callback'     => 'woo_new_product_tab_content'
    		);
    		        return $tabs;
    		}
    		函数woo_new_product_tab_content() {
    		        //新的选项卡内容
    		global $post;
    		        $custom  = get_post_meta( $post->ID, 'custom_text', true );
    			
    		echo $custom;
    		}
    WooCommerce.-How-to-manage-tabs-on-the-product-page-3
  4. 将更改保存在文件中;

  5. 确保修改后的文件已上传到服务器.

New tab 内容应该作为自定义文件添加,该文件是用我们添加到其中的PHP代码创建的 custom-function.php file:

//新的选项卡内容
global $post;
        $custom  = get_post_meta( $post->ID, 'custom_text', true );
	
echo $custom;
}

Where ‘custom_text’ is custom field title.

以便将文本添加到新产品中 tab,你应该做到以下几点:

  1. 去编辑产品;

  2. In Add New Custom Field Block,请使用 Enter new 按钮添加新的自定义文件:

    WooCommerce.-How-to-manage-tabs-on-the-product-page-4
  3. Type the custom field 标题添加在PHP代码-在我们的情况下,它是 custom_text;

  4. 你可以在下拉菜单中找到它:

  5. 输入您的自定义文本:

    WooCommerce.-How-to-manage-tabs-on-the-product-page-4a
  6. Update 对产品进行保存更改:

    WooCommerce.-How-to-manage-tabs-on-the-product-page-5

请随时查看下面的详细视频教程:

WooCommerce. 如何管理产品页面上的选项卡
这个条目被张贴了出来 WooCommerce教程 and tagged page, product, tab, WooCommerce. Bookmark the permalink.

提交罚单

如果您仍然无法找到关于您的问题的足够的教程,请使用以下链接向我们的技术支持团队提交请求. 我们将在接下来的24小时内为您提供我们的帮助和协助: 提交罚单