Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

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, 11:02 AM
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 01:39 AM. Reason: Changed subject to [solved]
  #2  
Old Sep 12, 2015, 01:10 PM
juggledad's Avatar
juggledad
 
23,765 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, 02: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, 02: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, 04:59 PM
juggledad's Avatar
juggledad
 
23,765 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 04:31 AM.
  #6  
Old Sep 15, 2015, 01: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 10: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 02:32 PM
SEARCH ERROR: Catchable fatal error:Object of class WP_Error could not be converted angelarose Plugins & Atahualpa 3 Jul 8, 2010 05: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 10:45 PM
Catchable fatal error: Object of class stdClass could not be converted to string !? neocratus Atahualpa 3 Wordpress theme 11 Dec 13, 2008 06:47 PM


All times are GMT -6. The time now is 03:17 AM.


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