1070 posts
  • Forum Superstar
  • Most Wanted Bounty Winner
  • Envato Studio (Microlancer) Beta Tester
  • Author had a Free File of the Month
  • Bought between 50 and 99 items
  • Referred between 50 and 99 users
  • Europe
  • Has been a member for 3-4 years
  • Exclusive Author
+1 more
Smartik says

How can I debug a Wordpress theme? I’m trying to debug/check for deprecated(forbiden) functions etc. I have installed Theme Check Plugin but looks like itself is broken and does not work.

ThemeCheck plugin return me 1xxxxx lines of notices(errors) and a fatal error to the end(Fatal error: Maximum execution time of 30 seconds exceeded in D:\xampp\htdocs\wordpress342\wp-content\plugins\theme-check\checks\i18n.php on line 28). Anyway this is not the problem.

Which plugins do you use to check your themes for errors? Please advice. :)

361 posts
  • Envato Studio (Microlancer) Beta Tester
  • Grew a moustache for the Envato Movember competition
  • Most Wanted Bounty Winner
  • Exclusive Author
  • Sold between 50 000 and 100 000 dollars
  • Helped protect Envato Marketplaces against copyright violations
  • Has been a member for 1-2 years
  • Referred between 1 and 9 users
  • Bought between 1 and 9 items
metrothemes says
Enable WP_DEBUG and fix all the notices and warnings
- Install http://wordpress.org/extend/plugins/developer as “Theme for a self-hosted WordPress installation”, and let it install the following debug tools:
  • Debug Bar
  • Debug Bar Cron
  • Log Deprecated Notices
  • Monster Widget
    • Theme Check
366 posts WordPress Guy
  • Envato Staff
  • Australia
  • Has been a member for 5-6 years
  • Contributed a Tutorial to a Tuts+ Site
  • Exclusive Author
  • Sold between 100 and 1 000 dollars
  • Bought between 50 and 99 items
  • Referred between 1 and 9 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
Japh Staff says

If Theme Check itself isn’t working, trying disabling all plugins and using the default theme, and then gradually re-enable things to see which is breaking the site.

279 posts
  • Sold between 50 000 and 100 000 dollars
  • Exclusive Author
  • Has been a member for 1-2 years
  • Bought between 10 and 49 items
  • Referred between 10 and 49 users
PrimaThemes says

ThemeCheck plugin return me 1xxxxx lines of notices(errors) and a fatal error to the end(Fatal error: Maximum execution time of 30 seconds exceeded in D:\xampp\htdocs\wordpress342\wp-content\plugins\theme-check\checks\i18n.php on line 28). Anyway this is not the problem.

I’ve experienced this strange one before. After countless hours investigation, I found the issue came from bad written code in one line!!! I need to move the files on my theme and then include it one by one to find the culprit. Sorry, I couldn’t share the example, I forgot to save it… :(

Right now, every time I make small changes to my code, I always test it using Theme Check, to make sure it doesn’t happen to me again in the future…

1070 posts
  • Forum Superstar
  • Most Wanted Bounty Winner
  • Envato Studio (Microlancer) Beta Tester
  • Author had a Free File of the Month
  • Bought between 50 and 99 items
  • Referred between 50 and 99 users
  • Europe
  • Has been a member for 3-4 years
  • Exclusive Author
+1 more
Smartik says

Thanks for replies. I appreciate that.

I forgot to say that my theme works perfectly, I always have WP_DEBUG enabled and I have 0 warnings/notices even on a clean instalation. Looks like I did a mistake somewhere, that’s why ThemeCheck plugin does not work.( http://wordpress.org/support/topic/plugin-theme-check-notice-uninitialized-string-offset-7952-in-i18nphp-on-line-27 ).

29 posts
  • Has been a member for 3-4 years
Delpierooo says

Hi,

I have the same issue.

PrimaThemes can you tell us which line of code it was? It might be the same issue for me. What would be the best way to investigate which theme code could be causing this?

Thanks in advance!

1070 posts
  • Forum Superstar
  • Most Wanted Bounty Winner
  • Envato Studio (Microlancer) Beta Tester
  • Author had a Free File of the Month
  • Bought between 50 and 99 items
  • Referred between 50 and 99 users
  • Europe
  • Has been a member for 3-4 years
  • Exclusive Author
+1 more
Smartik says

I think is a good idea to answer my own question with a solution since I found it.

The problem was that I had html tags inside of translation functions. Example:
_e('<strong>Here is my text to translate.</strong>','text_domain')
changed to this:
echo '<strong>'. _e('Here is my text to translate.','text_domain') .'</strong>';

:whistle:

366 posts WordPress Guy
  • Envato Staff
  • Australia
  • Has been a member for 5-6 years
  • Contributed a Tutorial to a Tuts+ Site
  • Exclusive Author
  • Sold between 100 and 1 000 dollars
  • Bought between 50 and 99 items
  • Referred between 1 and 9 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
Japh Staff says

Excellent work finding that! Thanks for posting the solution too :)

11 posts
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 2-3 years
rffa says

Post a bit old but I think it’s important to say. I’m developing my first premium theme and I had the same issue. The problem was related to translation functions too. In this case, an open parenthesis.

_e('Sorry =(  I dont have any posts with: ', 'text_domain')

That face =( was creating the problem. So I got rid of it. Now it’s just:

_e('Sorry , I dont have any posts with: ', 'text_domain')
1 post
  • Bought between 1 and 9 items
  • Europe
  • Exclusive Author
  • Has been a member for 1-2 years
  • Referred between 1 and 9 users
toleanu says

I think is a good idea to answer my own question with a solution since I found it. The problem was that I had html tags inside of translation functions. Example:
_e('<strong>Here is my text to translate.</strong>','text_domain')
changed to this:
echo '<strong>'. _e('Here is my text to translate.','text_domain') .'</strong>';
:whistle:
You should not use e under echo (use _()):
echo '<strong>'. __('Here is my text to translate.','text_domain') .'</strong>';
by
by
by
by
by
by