Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Calculator

0

60
Views
How to add a function only to woocommerce pages

I have this code I put in to remove part of my breadcrumbs in woocommerce which said "Products" in the second crumb:

if( $item_position === 2 ){continue;}

While it does work, it also removes the second breadcrumb from my other pages, while I just want it to remove it from woocommerce so I tried:

if ( is_woocommerce && $item_position === 2 ){continue;}

Which did the same as the previous, and I also tried:

if (is_woocommerce ($item_position === 2 ){continue;}

Which now works on my other pages but will completely remove breadcrumbs from woocommerce. I'm just learning and I have no idea what i'm doing wrong.

7 months ago · Juan Pablo Isaza
1 answers
Answer question

0

is_woocommerce() is a function.

The correct syntax is:

if (is_woocommerce() && $item_position === 2 ) { 
    continue; 
}
7 months ago · Juan Pablo Isaza Report
Answer question
Find remote jobs