Wordpress Themes - WP Forum at BFA
Click here to register or to donate.
Auto self-registration is not available here - far too many spammers. This forum has many, many backlinks and because of that there is an intense desire among spammers to drop their links here.

Wordpress Themes - WP Forum at BFA » WordPress Themes » Montezuma Theme »

[SOLVED] Error:Object WP_Error could not be converted to string ... breadcrumbs ... o


  #1  
Old Sep 12, 2015, 12:02 PM
piotao
 
6 posts · Oct 2014
Hi,
big kudos to you Flynn for Montezuma theme, I love it, and can't imagine to work with something different. This theme and your ways of solving site management defined my WP understanding. I have a site with 300+ posts, several pages and categories, etc. Since long time there is a log line which appears to show randomly and is looking like this:

Code:
[Thu Sep 10 10:57:38 2015] [error] [client 157.55.39.194] PHP Catchable fatal error:  Object of class WP_Error could not be converted to string in /home/piotao/PKB/www/wp-content/themes/montezuma/includes/breadcrumbs.php on line 56
[Thu Sep 10 11:38:31 2015] [error] [client 207.46.13.157] PHP Catchable fatal error:  Object of class WP_Error could not be converted to string in /home/piotao/PKB/www/wp-content/themes/montezuma/includes/breadcrumbs.php on line 56
[Thu Sep 10 15:25:05 2015] [error] [client 66.249.64.98] PHP Catchable fatal error:  Object of class WP_Error could not be converted to string in /home/piotao/PKB/www/wp-content/themes/montezuma/includes/breadcrumbs.php on line 56
[Thu Sep 10 18:26:35 2015] [error] [client 208.115.111.68] PHP Catchable fatal error:  Object of class WP_Error could not be converted to string in /home/piotao/PKB/www/wp-content/themes/montezuma/includes/breadcrumbs.php on line 56
[Thu Sep 10 23:00:53 2015] [error] [client 66.249.64.93] PHP Catchable fatal error:  Object of class WP_Error could not be converted to string in /home/piotao/PKB/www/wp-content/themes/montezuma/includes/breadcrumbs.php on line 56
[Fri Sep 11 10:00:09 2015] [error] [client 157.55.39.210] PHP Catchable fatal error:  Object of class WP_Error could not be converted to string in /home/piotao/PKB/www/wp-content/themes/montezuma/includes/breadcrumbs.php on line 56
I'm unable to find any solution to this. I have read a similar topic here on the forum, where you had already investigated similar problem. You have said that all posts should have it's category assignement. I checked this and all of them have at least one category. However, there is no category 'Uncategorized' (I changed it's name). I suspect that some IDs could be set wrong, dunno.

Could you be so nice and find some time to help?
  • My address: http://polskikursblendera.pl
  • Montezuma 1.2.7, WP 4.3
  • My modifications include only few new virtual templates and css styles, I did not touch PHP code.
  • Plugins installed and activated: Broken link checker, Exploit scanner, Google Analitics Dashboard for WP, Growmap Anti Spambot Plugin, Hyper Cache, Justified Image Grid, List category posts, Media Library Assistant, Multi-Column Tag Map, SEO Ultimate, Simple Google Sitemap XML, T(-) Countdown, Term Management Tools, Theme Check, TinyMCE Advanced, Wordpress shortcodes, WP Show IDs.
  • Plugins installed and disabled: WP Edit, Wordpress Importer, Shortcodes Ultimate, Advanced Page Manager.

Last edited by piotao; Sep 15, 2015 at 02:39 AM. Reason: Changed subject to [solved]
  #2  
Old Sep 12, 2015, 02:10 PM
juggledad's Avatar
juggledad
 
23,682 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
Quote:
However, there is no category 'Uncategorized' (I changed it's name). I suspect that some IDs could be set wrong, dunno.
From my research, I would say that there is a 99% probablilty that this is the cause. I found a WP post that gave a suggestion you can try.

change line 56 from
HTML Code:
echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' ');
to
HTML Code:
echo is_wp_error( $cat_parents = get_category_parents($cat, TRUE, ' ' . $delimiter . ' ') ) ? '' : $cat_parents;
NOTE: this is only a bandaid for an error in your database. You could see this in many themes (any that use the 'echo get_category_parents.....code)
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #3  
Old Sep 12, 2015, 03:17 PM
piotao
 
6 posts · Oct 2014
Thank you, I was not aware that there is such a nice function. Things seems to be nicely silenced by this nifty hack.

But if I upgrade Montezuma to the next (possibly) release, this will be lost, until I enter it again, will it not?
  #4  
Old Sep 12, 2015, 03:40 PM
piotao
 
6 posts · Oct 2014
Hi again, the code is not exactly the same. Actually I'm writing this post the second time, because I closed a browser accidentally

So the code is the following:
Code:
} elseif ( is_attachment() ) {
  $parent = get_post($post->post_parent);
  $cat = get_the_category($parent->ID); $cat = $cat[0];
  echo "<li>" . get_category_parents($cat, TRUE, "</li><li>");
So as I can see, this code is executed ONLY for those posts, which have attachments. I don't have much of such posts. This code is tend to raise an error only when there is no parent! And there is obviously no parent at all when I have them in only one category. So maybe this code will be OK, if you can see and judge. I'm not a PHP developer nor I don't know the code. Is my thinking valid?

Code:
} elseif ( is_attachment() ) {
  $parent = get_post($post->post_parent);
  if(defined($parent)){
    $cat = get_the_category($parent->ID); $cat = $cat[0];
    if(defined($cat)){
      echo "<li>" . get_category_parents($cat, TRUE, "</li><li>");
    }
    else{
      echo "<li></li>";
    }
  }
  else{
    echo "<li></li>";
  }
Also I noted that your syntax in that place is a bit different than in my copy of code. Which version do you use? Maybe my Montezuma is pretty outdated?
  #5  
Old Sep 12, 2015, 05:59 PM
juggledad's Avatar
juggledad
 
23,682 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
Quote:
if I upgrade Montezuma to the next (possibly) release, this will be lost, until I enter it again
yes it will be lost, you will have to re-fix it after each upgrade
Quote:
Also I noted that your syntax in that place is a bit different than in my copy of code. Which version do you use? Maybe my Montezuma is pretty outdated?
I used version 1.2.8 for the patch.

edit style.css and you will see the version you have. it is important to let me know so I can see what is ion line 56 of that version. My 'patch' might not be correct, however if you are on version 1.2.8 and your line 56 is not the same as mine, you might have other issues...
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support

Last edited by juggledad; Sep 19, 2015 at 05:31 AM.
  #6  
Old Sep 15, 2015, 02:38 AM
piotao
 
6 posts · Oct 2014
OK, this is strange. I have hacked that file and patch I suggested above works. The Montezuma theme has version 1.2.8 as well.

So the strange thing is that this line was not the same. I don't remember if I mess up something, but nevertheless after last upgrade it should be cleaned. Maybe this file is not update with the update? Dunno.

This repair works, so thank you anyway, your help is valuable and much appreciated!

Bookmarks

Tags
breadcrumbs, error, log, montezuma, wp_error

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Catchable fatal error: Object of class WP_Error could not be converted dazzle Plugins & Atahualpa 16 Jun 13, 2011 11:44 AM
Catchable fatal error: Object of class WP_Error bfa_postinfo.php on line 308 lickorish Center area post/pages 1 Sep 17, 2010 03:32 PM
SEARCH ERROR: Catchable fatal error:Object of class WP_Error could not be converted angelarose Plugins & Atahualpa 3 Jul 8, 2010 06:05 PM
Catchable fatal error: Object of class stdClass could not be converted to string in / mathmojo Atahualpa 3 Wordpress theme 7 May 16, 2010 11:45 PM
Catchable fatal error: Object of class stdClass could not be converted to string !? neocratus Atahualpa 3 Wordpress theme 11 Dec 13, 2008 07:47 PM


All times are GMT -6. The time now is 06:43 AM.


Powered by vBulletin® Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.