【发布时间】:2020-09-08 14:31:52
【问题描述】:
我有以下代码向产品页面添加一个标签,它不会是静态的,也不会与所有其他产品相同。
<div id="tabs" class="htabs">
<a href="#tab-description" class="selected">{{'products.product.description' | t}}</a>
{%- if product.description contains "Videos" -%}
<a href="#tab-video">
{{ product.description | split: '<h6>' | last | remove: '<h6>' | split: '</h6>' | first}}
</a>
{%- endif -%}
{%- if settings.reviews_enable -%}
<a href="#tab-review" id="product-reviews-a" class="">{{'products.product.customer_reviews' | t}}</a>
{%- endif -%}
{%- if settings.product_tab_content_1 != blank -%}
<a href="#tab-cus-1">{{ settings.product_tab_title_1 }}</a>
{%- endif -%}
{%- if settings.product_tab_content_2 != blank -%}
<a href="#tab-cus-2">{{ settings.product_tab_title_2 }}</a>
{%- endif -%}
{%- if settings.product_tab_content_3 != blank -%}
<a href="#tab-cus-3">{{ settings.product_tab_title_3 }}</a>
{%- endif -%}
{%- if settings.product_tab_content_4 != blank -%}
<a href="#tab-cus-4">{{ settings.product_tab_title_4 }}</a>
{%- endif -%}
</div>
<div id="tab-description" class="tab-content" itemprop="description
{{product.description}}</div>
<style>
@media screen and (min-width: 768px) {
.tab-content {
max-width: 80% !important;
margin: 0 auto;
}
}
</style>
{%- if product.description contains "Videos" -%}
<div id="tab-video" class="tab-content">{{ product.description | split: '<h6>' | last | remove: '<h6>' | split: '</h6>' | first}}</div>
{%- endif -%}
{%- if settings.reviews_enable -%}
<div id="tab-review" class="tab-content"><div id="shopify-product-reviews" data-id="{{product.id}}">{{product.metafields.spr.reviews}}</div></div>
{%- endif -%}
{%- if settings.product_tab_content_1 != blank -%}
<div id="tab-cus-1" class="tab-content">{{- pages[settings.product_tab_content_1].content -}}</div>
{%- endif -%}
{%- if settings.product_tab_content_2 != blank -%}
<div id="tab-cus-2" class="tab-content">{{- pages[settings.product_tab_content_2].content -}}</div>
{%- endif -%}
{%- if settings.product_tab_content_3 != blank -%}
<div id="tab-cus-3" class="tab-content">{{- pages[settings.product_tab_content_3].content -}}</div>
{%- endif -%}
{%- if settings.product_tab_content_4 != blank -%}
<div id="tab-cus-4" class="tab-content">{{- pages[settings.product_tab_content_4].content -}}</div>
{%- endif -%}
所有其他选项卡默认由主题创建。
我要添加的是 “视频” 选项卡,但是如何在 “描述” 主选项卡中删除 <h6>Videos</h6> 及其后面的任何文本?
我如何让<h6>Videos</h6> 下的任何内容出现在'视频' 标签下?
当前输出:
视频和嗨不应显示在“描述”标签中。
如您所见,Hi 没有显示在 “视频” 选项卡中,也没有显示在我希望显示的位置。
【问题讨论】: