I have added some code in header.php but it is not showing in shop page. It is showing all other pages.
if( is_home() || ! $ed_section || ! ( is_front_page() || is_page_template( 'template-home.php' ) ) ){
echo '<div class = "container"><div id="content" class="site-content">
<div class="tab1">
<a class="cat_button" href="/">Appetizers & Snacks</a>
<a class="cat_button" href="/">Fillers International</a>
<a class="cat_button" href="/">Meals and More</a>
<a class="cat_button" href="/">Mains Indian</a>
<a class="cat_button" href="/">Mains Oriental</a>
<a class="cat_button" href="/">Mains International</a>
<a class="cat_button" href="/">Desserts And Drinks</a>
</div>
<div class = "row">';
} ?>
This is my code and I added the lines <div class="tab1">
<a class="cat_button" href="/">Appetizers & Snacks</a>
<a class="cat_button" href="/">Fillers International</a>
<a class="cat_button" href="/">Meals and More</a>
<a class="cat_button" href="/">Mains Indian</a>
<a class="cat_button" href="/">Mains Oriental</a>
<a class="cat_button" href="/">Mains International</a>
<a class="cat_button" href="/">Desserts And Drinks</a>
</div>
This tab class is showing in all pages excepts shop page, category page, product page.
I have added some code in header.php but it is not showing in shop page. It is showing all other pages.
if( is_home() || ! $ed_section || ! ( is_front_page() || is_page_template( 'template-home.php' ) ) ){
echo '<div class = "container"><div id="content" class="site-content">
<div class="tab1">
<a class="cat_button" href="https://packnchew/product-category/appetizers-snacks/">Appetizers & Snacks</a>
<a class="cat_button" href="https://packnchew/product-category/fillers-international/">Fillers International</a>
<a class="cat_button" href="https://packnchew/product-category/meals-more/">Meals and More</a>
<a class="cat_button" href="https://packnchew/product-category/mains-indian/">Mains Indian</a>
<a class="cat_button" href="https://packnchew/product-category/mains-oriental/">Mains Oriental</a>
<a class="cat_button" href="https://packnchew/product-category/mains-international/">Mains International</a>
<a class="cat_button" href="https://packnchew/product-category/desserts-drinks/">Desserts And Drinks</a>
</div>
<div class = "row">';
} ?>
This is my code and I added the lines <div class="tab1">
<a class="cat_button" href="https://packnchew/product-category/appetizers-snacks/">Appetizers & Snacks</a>
<a class="cat_button" href="https://packnchew/product-category/fillers-international/">Fillers International</a>
<a class="cat_button" href="https://packnchew/product-category/meals-more/">Meals and More</a>
<a class="cat_button" href="https://packnchew/product-category/mains-indian/">Mains Indian</a>
<a class="cat_button" href="https://packnchew/product-category/mains-oriental/">Mains Oriental</a>
<a class="cat_button" href="https://packnchew/product-category/mains-international/">Mains International</a>
<a class="cat_button" href="https://packnchew/product-category/desserts-drinks/">Desserts And Drinks</a>
</div>
This tab class is showing in all pages excepts shop page, category page, product page.
Share Improve this question asked Jul 6, 2019 at 10:44 Shobha PatwalShobha Patwal 13 bronze badges2 Answers
Reset to default 0Can you use WooCommerce conditional tags instead of the default? For example, if you want this block of content to appear for all pages, use is_woocommerce()
or if it should only appear on the main shop page, use is_shop()
.
For example:
if( is_woocommerce() ){
//echo your content here...
} ?>
Source: https://docs.woocommerce/document/conditional-tags/
if( is_home() || ! $ed_section || ! ( is_front_page() || is_page_template( 'template-home.php' ) ) ){
echo '<div class = "container"><div id="content" class="site-content">
<div class="tab1">
<a class="cat_button" href="https://packnchew/product-category/appetizers-snacks/">Appetizers & Snacks</a>
<a class="cat_button" href="https://packnchew/product-category/fillers-international/">Fillers International</a>
<a class="cat_button" href="https://packnchew/product-category/meals-more/">Meals and More</a>
<a class="cat_button" href="https://packnchew/product-category/mains-indian/">Mains Indian</a>
<a class="cat_button" href="https://packnchew/product-category/mains-oriental/">Mains Oriental</a>
<a class="cat_button" href="https://packnchew/product-category/mains-international/">Mains International</a>
<a class="cat_button" href="https://packnchew/product-category/desserts-drinks/">Desserts And Drinks</a>
</div>
<div class = "row">';
} ?>
Check out very first line,
if( is_home() || ! $ed_section || ! ( is_front_page() || is_page_template( 'template-home.php' ) ) ){
The code inside that block is for Home Front page only. If you want that to work on all pages, I will recommend you to put above that or include woocommerce in the if statement as well.
Good Luck.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745341062a4623327.html
评论列表(0条)