peggysdev
Forum Replies Created
-
Hello Amit,
I am new to WordPress and evaluating it locally to check suitability for a new project, so unfortunately I don’t have a public page to link to.
If the CPT slug is changed then the Single page is rendered correctly, as expected, because the code shown above is not called.
However, if the slug remains as ‘product’, as one might reasonably expect it to be, then the code above raises an exception and the Single page fails to render correctly.
Exception has occurred.
Fatal error: Uncaught Error: Call to undefined function wc_get_page_id() in /htdocs/wp-content/themes/oceanwp/inc/breadcrumbs.php:655
Stack trace:
#0 /htdocs/wp-content/themes/oceanwp/inc/breadcrumbs.php(402): OceanWP_Breadcrumb_Trail->add_singular_items()
#1 /htdocs/wp-content/themes/oceanwp/inc/breadcrumbs.php(205): OceanWP_Breadcrumb_Trail->add_items()
#2 /htdocs/wp-content/themes/oceanwp/inc/breadcrumbs.php(65): OceanWP_Breadcrumb_Trail->__construct(Array)
#3 /htdocs/wp-content/themes/oceanwp/partials/page-header.php(62): oceanwp_breadcrumb_trail()
#4 /htdocs/wp-includes/template.php(724): require(‘…’)Other themes, such as GeneratePress and twentytwenty handle a CPT with a slug ‘product’ correctly.
Lines 650-659
// If the post type is 'product'. else if ( 'product' === $post->post_type && 'none' != $products_tax ) { if ( 'shop' == $products_tax ) { $shop_id = wc_get_page_id( 'shop' ); $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_permalink( $shop_id ) ), get_the_title( $shop_id ) ); } else { $this->add_post_terms( $post_id, $products_tax ); } }