-2

This sounds like a weird question to ask but I am working on a Wordpress blog and I'm editing some PHP codes and instead of deleting it I normally comment out some codes I may use later. But this time, when I try to use the # and // it's still reading the code and it reads those symbols as texts instead. Is this a bug? Or am I missing something, never had this problem before.

<?php get_template_part( 'sections/content', 'page' ); ?>

This piece of code really don't want to be commented out. Its just really frustrating.

1
  • 3
    Where are you putting the characters?
    – TZHX
    Nov 10, 2015 at 8:14

2 Answers 2

2

try to comment it with /**/ so eg:

<?php /* get_template_part( 'sections/content', 'page' ); */ ?>

when you use //, you comment out ?>

<?php // get_template_part( 'sections/content', 'page' );  ?>

so when you want use // then you need to add a linebreak

<?php // get_template_part( 'sections/content', 'page' );  
?>

see comment syntax php

0
0

Figured it out, there was a bunch of nested PHP codes and I realized I was commenting outside its opening PHP tag.

//<?php get_template_part( 'sections/content', 'page' ); ?>

instead of

<?php //get_template_part( 'sections/content', 'page' ); ?>

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.