I'm trying to find out why any template different than index.php doesn't work.

I've created a category-news.php file (also tried with category-4.php and mostly all alternatives), but when opening this url, I see a white page and checking the source code, I see the php code as HTML comments.

Any idea to what could cause that?

I've checked the functions.php (that has been written by me) and there are no places that does that. As for plugins, disabling all of them doesn't help.

UPDATE - More information about the template page, as per request in comments

You can find the category-news.php source code here. You were right: I was only checking with Google's developer tools and there I see the php code changed as HTML comments. When looking at the actual HTML code, I only see the original php code. Either way, this shouldn't happen and since the rest of the theme works as expected, I think there must be something wrong with the file itself. As for the encoding, I always use phpStorm and never changed a single setting on it (at least for what concerns file encoding). Actually I don't even now how to check/change the encoding from phpStorm and any text editor I'm using (TextWrangler, Espresso, or TextEdit) doesn't have this option (I'm on a Mac).

  • 1
    Can you link to the actual code you have in category-news.php?
    – EAMann
    Apr 15, 2013 at 20:37
  • hmm... the php code is visible, when you view the html source.
    – birgire
    Apr 15, 2013 at 20:38
  • 1
    how did you encode the file when you saved it?
    – birgire
    Apr 15, 2013 at 20:48
  • I don't see the "php code as HTML comments". I just see the PHP printed to the screen.
    – s_ha_dum
    Apr 15, 2013 at 21:15
  • OK, let me explain. That URL (/category/news) is passed to WordPress' index.php. WordPress will include() files to generate the page, including category-news.php. If the content of the file is printing to the page, then you have something else happening on the server. Perhaps an encoding issue, another PHP file that's printing output rather than running it, etc. But there are no HTML comments here, and unless you're doing something else on the site there's no way that URL would produce that output on a standard installation.
    – EAMann
    Apr 15, 2013 at 21:48

1 Answer 1


It was indeed an encoding issue. Opening with Notepad++ (I've managed to open it from a PC), I've realized that the file was encoded as UCS-2 something (I don't remember exactly if Big or Little Endian).

I have no idea why this happened and how to avoid that in the future, as I've simply created this file from an existing file that has the right encoding (ANSI): I'll investigate with JetBrains support to see if they can find a possible cause.

Thanks everybody!

  • Great you could work it out. Please also accept your answer to solve the question.
    – tfrommen
    Apr 16, 2013 at 9:30
  • Thanks, I know that: that's why I didn't accept yet. Apr 16, 2013 at 12:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.