1

I have had a wp-template file that has worked for a year. Suddenly last night I started seeing some of the template code being printed out to the page:

$query = new WP_Query( array( 'posts_per_page' => 10, 'cat'=>-145, 'paged'=>$paged ) ); ?>
<?php if ( $query->have_posts() ) : ?>
<?php /* The loop */ ?>

Anything above (and the footer) is working fine. However,I see code like this: 10, 'cat'=>-145, 'paged'=>$paged ) ); ?> ie a section of what I have been using.

What am I doing wrong please?

maxelcat
  • 1,333
  • 2
  • 18
  • 31

2 Answers2

0

There is must some html tag or double quotes " or single quote ' issue please check your file.

Shahid Latif
  • 135
  • 1
  • 6
  • well, that's what I would have suspected - so I did look for that, and like I said its worked for a year. But I'll check again – maxelcat Aug 10 '16 at 10:40
  • May be you have just update your wordpress, php or mysql version on your server and that thing effect your code. – Shahid Latif Aug 10 '16 at 10:45
0

Thanks all - but I found it

in the line above I had <? code here which worked before. If I now make it fuller by putting <?php it all works.

maxelcat
  • 1,333
  • 2
  • 18
  • 31
  • 1
    That's because de PHP configuration. Maybe you have the short_open_tag disabled? See this: http://stackoverflow.com/questions/2185320/how-to-enable-php-short-tags – Victor Aug 10 '16 at 11:29
  • I never even knew about that, or what it was called! Thanks – maxelcat Aug 11 '16 at 14:18