• I have several pages on my site that don’t require comments: I’d like to hide the “Comments Off” tag at the bottom of the post. Is there a plug-in that does this, or can it be done some other way?

    Many thanks for any tips.

Viewing 3 replies - 16 through 18 (of 18 total)
  • @finchy
    the way you comment the line (html comments), the php will still execute and the results will be shown in the html code in your browser, although not visible to the viewer (adding to loading time).

    if you want to comment php functions, you can for instance use:
    method 1
    <?php // comments_template(); ?>
    double slash characters // – to comment the rest of the line after the //
    method 2

    <?php /* comments_template();
    more code;
    another bit of code;
    function(); */ ?>

    /* */ – to coment everything between the start /* and the end */

    using these methods stops the execution of the code already in the server, so nothing will appear in the browser

    i ran into the same issue, but i wanted to hide it in some pages only, not all, this is what i did – https://www.dir.vc/forum/index.php?topic=645.0

    hope it helps.

    M.

    To hide the comments field I used a conditional statement so the comments output was hidden on my frontpage and displayed on all other pages;

    <?php if (!is_front_page()) comments_template('', true); ?>

Viewing 3 replies - 16 through 18 (of 18 total)
  • The topic ‘Can I hide “comments off” tag?’ is closed to new replies.