Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Using cherry framework with child theme, in functions.php trying to override woocommerce template.
- add_filter( 'template_include', 'wc_template_check' );
- function wc_template_check( $template ) {
- if ( is_shop() ){
- return get_stylesheet_directory() . '/woocommerce/content-product_cat.php';
- }
- }
- ### as a result I get this error.
- /* Catchable fatal error: Object of class WP_Error could not be converted to string in F:\xampp\htdocs\estlita.lt\wp-content\themes\estlita\woocommerce\content-product_cat.php on line 38
- * Call Stack #TimeMemoryFunctionLocation 10.0004134752{main}( )...\index.php:0 20.0007136696
- * require( 'F:\xampp\htdocs\estlita.lt\wp-blog-header.php' )...\index.php:17 31.421541508992
- * require_once( 'F:\xampp\htdocs\estlita.lt\wp-includes\template-loader.php' )...\wp-blog-header.php:16 41.458441756752
- * include( 'F:\xampp\htdocs\estlita.lt\wp-content\themes\estlita\woocommerce\content-product_cat.php' )...\template-loader.php:74
- */
- ### On line 38 there is such code:
- ### <a href="<?php echo get_term_link( $category->slug, 'product_cat' ); ?>">
- ### On Cherry Framework there is Custom functions files /includes/custom-functions.php
- ### Maybe this somehow messes up get_term_link.
- // Product title length
- add_filter( 'the_title', 'tm_product_title_length', 10, 2 );
- function tm_product_title_length($title) {
- if (is_admin())
- return $title;
- global $post, $woocommerce_loop;
- $post_type = get_post_type( $post );
- if ($woocommerce_loop) {
- if ( 'product' == $post_type ) {
- $length_limit = intval( of_get_option('cat_title_length_limit') );
- if ( "" != $length_limit ) {
- $words = explode(' ', $title, ($length_limit + 1));
- if( count($words) > $length_limit ) {
- array_pop($words);
- $title = implode(' ', $words) . '... ';
- }
- }
- }
- }
- return $title;
- }
Advertisement
Add Comment
Please, Sign In to add comment