WooCommerce. 如何管理产品页面上的选项卡
July 13, 2015
本教程将向您展示如何管理Woocommerce产品页面上的选项卡.
WooCommerce. 如何管理产品页面上的选项卡在产品页面上,你通常可以找到标签. 为了编辑现有的选项卡,您可以单击 编辑产品 button:
![WooCommerce.-How-to-manage-tabs-on-the-product-page-1](/help/wp-content/uploads/2015/07/WooCommerce.-How-to-manage-tabs-on-the-product-page-1-300x117.png)
Description tab 显示在产品内容部分设置的产品描述;
Video tab 是在…的帮助下设置的 Custom Field 叫做视频链接-你可以在自定义字段块中找到它;
Reviews tab 显示评论-你可以很容易地找到和管理他们在产品页面的底部 dashboard:
![WooCommerce.-How-to-manage-tabs-on-the-product-page-2](/help/wp-content/uploads/2015/07/WooCommerce.-How-to-manage-tabs-on-the-product-page-2-300x159.png)
以便添加新的 tab,你应该做到以下几点:
到达服务器上的文件 FTP or hosting cPanel file manager;
Open custom-function.php 文件位于 wp-content / themex themeXXX /包括 folder;
将以下代码添加到文件底部,就在结束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; }
将更改保存在文件中;
确保修改后的文件已上传到服务器.
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,你应该做到以下几点:
去编辑产品;
In Add New Custom Field Block,请使用 Enter new 按钮添加新的自定义文件:
Type the custom field 标题添加在PHP代码-在我们的情况下,它是 custom_text;
你可以在下拉菜单中找到它:
输入您的自定义文本:
Update 对产品进行保存更改:
请随时查看下面的详细视频教程:
WooCommerce. 如何管理产品页面上的选项卡