• Resolved Enno

    (@ewx)


    Hi there!
    I created a child theme where the comments block is highlighted.
    <div id=”commentpost”>
    <!– If comments are open, but there are not comments. –>
    </div>

    But if no comments allowed for this page or post I would like to hide this block.

    doing this via CSS using pseudeo selector :empty does not work because the DIV-Tag is not empty. There is a space somewhere.
    So I tried to copy comments.php to my child theme directory and set the style “display:none” directly in the div tag:

    <div id=”commentpost” <?php if ( !comments_open() ) echo ‘style=”display:none;”‘; ?>>

    as this did not work I checked if there is any effect at all:

    <?php if ( !comments_open() ) { echo ‘<H1>111</H1>’; } else { echo ‘<H1>222</H1>’; } ?>

    But now effect. At least I tried to just set text in comments.php <H1>DO IT NOW!!</H>.

    As this also did not work it seems to me that the comments.php of my child theme is not used at all… :/

    I tried this also using twentythirteen theme and there it works.
    It works so well that the functionality I’d like to implement in your theme (not displaying any div-comment-block if comments are not allowed) is already built in.

    So I assume that the Block in page.php causes the problem:
    <?php comments_template( ”, true ); ?>
    <?php else : ?>
    <?php get_template_part( ‘lib/templates/result’ ); ?>
    <?php endif; ?>
    <?php endif; ?>

    What is the best way to avoid useless DIV-commentpost-tags?

    Thanks
    Enno

Viewing 8 replies - 1 through 8 (of 8 total)
  • Theme Author Richie KS

    (@rkcorp)

    i think the comment form will be hidden if you set ‘no comment’ for the particular post or page. by default, it will have the comment close (yellow) notification in that area but you can disable the comment notification in theme option->posts setting->disable comment notice.

    but previous commentar will still showed only no comment submit form will appearead.

    Thread Starter Enno

    (@ewx)

    Hi Richie,
    the problem is that the form is not completely hidden…!

    This stub remains although comments are closed:
    <div id=”commentpost”>
    <!– If comments are open, but there are not comments. –>
    </div>

    For my understanding it should not appear at all.

    1. Problem:
    my changes in comments.php are not respected

    2. Problem
    the div-commentpost-stub. which should not be created at all.

    Regards

    Enno

    Theme Author Richie KS

    (@rkcorp)

    could you try edit the parent theme single.php
    <?php comments_template( ”, true ); ?>
    to
    <?php comments_template(); ?>

    and see if the child theme is effected. i might need to add/update this in next version.

    Thread Starter Enno

    (@ewx)

    Yes, I’ll try tomorrow. Thanks!

    Thread Starter Enno

    (@ewx)

    No, sorry, that didn’t work.

    Thread Starter Enno

    (@ewx)

    I have a multi-site-installation. maybe this is important…?

    Thread Starter Enno

    (@ewx)

    Sorry, I was wrong! Using
    <?php comments_template( ); ?>
    In single.php solves the problem: the child’s theme comments.php is taken now!
    Thanks!

    Thread Starter Enno

    (@ewx)

    I have the idea that the additional plugin “vicomi” caused the strange behaviour…
    W/o vicomi the childs comments.php will be loaded using
    <?php comments_template( '', true ); ?>
    Regards Enno

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘comments.php of child-theme’ is closed to new replies.