WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Commenting in the php files problem (4 posts)

  1. skeeterz71
    Member
    Posted 1 year ago #

    Hi,

    I'm attempting to comment some changes I am doing in some files. For some reason the single line comment and block comments I am adding are not working. Anybody know why?

    Example 1 shows the file that I commented.

    <?php endif; ?>
    		<header class="entry-header">
    		// This is a comment
    		<?php if ( !(is_search() || is_archive() || is_category() || is_tag()) ) : // Only display Excerpts for Search ?>
    		<?php the_post_thumbnail(); ?>
    			<?php endif; ?>

    However if you view the web page here it displays
    // This is a comment

    Any help would be appreciated

  2. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    Where you have that comment appears to be in HTML code (not php), so you'd need to use HTML comments <!-- ...... -->

  3. pete_398
    Member
    Posted 1 year ago #

    // This is a comment

    should be

    <?php // This is a comment ?>

    Try not to turn php on and off so much, if possible. if there is a block of php code, just turn it on at start and off at the finish, makes reading code a bit easier.

  4. skeeterz71
    Member
    Posted 1 year ago #

    Thanks Wpyogi,

    That solved the problem. I'm new to this stuff sort of..

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags