Home › Forums › WoodMart support forum › Problem with blog
Problem with blog
- This topic has 9 replies, 2 voices, and was last updated 6 years, 1 month ago by
Artem Temos.
-
AuthorPosts
-
March 21, 2019 at 11:24 am #114112
ihor.youxParticipantHi!
I use WooCommerce AJAX Products Filter PRO + WPML in your theme.
In post page I get error PHP Catchable fatal error: Object of class WP_Error could not be converted to string in /wp-content/themes/woodmart/inc/template-tags.php on line 1160
I comment this code and blog works. But problem withh categories, in site post have category Без рубрики(eng. Uncategoriezed), but in admin I set Блог(eng. Blog).
I think problem with AJAX Products Filter PRO, because Blog works correctly when I deactiveted.
But also all work correctly when I swith theme by twentynineteen.I print $cat(in Attachments), with your theme get_the_category return empty array.
PS I print also without $post->ID
Can you help me pls? AJAX Products Filter PRO is very important for meAttachments:
You must be logged in to view attached files.March 21, 2019 at 12:38 pm #114129
Artem TemosKeymasterHi,
Could you please test how it works now?
March 21, 2019 at 1:30 pm #114150
ihor.youxParticipantThe problem disappeared! Thank you )
March 21, 2019 at 2:32 pm #114167
Artem TemosKeymasterGreat 🙂
April 5, 2019 at 4:25 pm #117235
ihor.youxParticipantHi!)
This problem reappeared (
And I dont now why…
I activated 2 plugins Autoptimize, W3 Total Cache and updated theme, but when I deactiveted plugins the problem did not disappear.April 6, 2019 at 8:56 am #117358
Artem TemosKeymasterHi,
Try to edit the file
woodmart/inc/template-tags.php
and replace the following codeif ($show_current == 0) $cats = preg_replace("#^(.+)$delimiter$#", "$1", $cats); $cats = str_replace('<a', $link_before . '<a' . $link_attr, $cats); $cats = str_replace('</a>', '</a>' . $link_after, $cats); if ($show_title == 0) $cats = preg_replace('/ title="(.*?)"/', '', $cats); echo wp_kses_post( $cats );
with this one
if ( !is_wp_error($cats) ) { if ($show_current == 0) $cats = preg_replace("#^(.+)$delimiter$#", "$1", $cats); $cats = str_replace('<a', $link_before . '<a' . $link_attr, $cats); $cats = str_replace('</a>', '</a>' . $link_after, $cats); if ($show_title == 0) $cats = preg_replace('/ title="(.*?)"/', '', $cats); echo wp_kses_post( $cats ); }
Regards
April 8, 2019 at 8:06 am #117603
ihor.youxParticipantHi, its works, but incorrect category displayed
April 8, 2019 at 11:21 am #117647
Artem TemosKeymasterYes, because some of the plugin influence this functionality and our theme display what is stored in the database.
April 8, 2019 at 12:06 pm #117661
ihor.youxParticipantIt’s strange, the yoast plugin defines the category correctly.
Replaced this
$cat = get_the_category(); $cat = $cat[0];
with
$cat = get_post_meta($post->ID, '_yoast_wpseo_primary_category', true);
April 8, 2019 at 12:34 pm #117668
Artem TemosKeymasterBut the first code should work since it is a native WordPress function.
-
AuthorPosts
- You must be logged in to create new topics. Login / Register