Quantcast
Channel: WordPress.org Forums » All Posts
Viewing all articles
Browse latest Browse all 96570

ewx on "[Theme: MesoColumn] comments.php of child-theme"

$
0
0

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 all articles
Browse latest Browse all 96570

Trending Articles