Skip to content

Instantly share code, notes, and snippets.

@NilsDannemann
Created April 4, 2017 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NilsDannemann/a6174170846719099411bf6c3a681c27 to your computer and use it in GitHub Desktop.
Save NilsDannemann/a6174170846719099411bf6c3a681c27 to your computer and use it in GitHub Desktop.
Comments.php with broken (?) Comment Form
<?php
if ( post_password_required() ) {
echo '<h3 class="comments-header">' . __( 'Password Protected', 'buddypress' ) . '</h3>';
echo '<p class="alert password-protected">' . __( 'Enter the password to view comments.', 'buddypress' ) . '</p>';
return;
}
if ( is_page() && !have_comments() && !comments_open() && !pings_open() )
return;
if ( have_comments() ) :
$num_comments = 0;
$num_trackbacks = 0;
foreach ( (array) $comments as $comment ) {
if ( 'comment' != get_comment_type() )
$num_trackbacks++;
else
$num_comments++;
}
?>
<?php else : ?>
<?php if ( pings_open() && !comments_open() && ( is_single() || is_page() ) ) : ?>
<p class="comments-closed pings-open">
<?php printf( __( 'Comments are closed, but <a href="%1$s" title="Trackback URL for this post">trackbacks</a> and pingbacks are open.', 'buddypress' ), trackback_url( '0' ) ); ?>
</p>
<?php elseif ( !comments_open() && ( is_single() || is_page() ) ) : ?>
<p class="comments-closed">
<?php _e( 'Comments are closed.', 'buddypress' ); ?>
</p>
<?php endif; ?>
<?php endif; ?>
<?php if ( comments_open() ) : ?>
<section class="comments">
<div class="comments__container">
<!-- Comments Form -->
<div class="comments-form">
<div class="comments-form__container">
<div class="panel">
<?php comment_form(); ?>
</div>
</div>
</div>
<!-- Comments List -->
<?php do_action( 'bp_before_blog_comment_list' ); ?>
<ol class="comments-list">
<?php wp_list_comments( array( 'callback' => 'bp_dtheme_blog_comments', 'type' => 'comment' ) ); ?>
</ol>
<?php do_action( 'bp_after_blog_comment_list' ); ?>
</div>
</section>
<?php endif; ?>
<?php if ( !empty( $num_trackbacks ) ) : ?>
<div id="trackbacks">
<h3><?php printf( _n( '1 trackback', '%d trackbacks', $num_trackbacks, 'buddypress' ), number_format_i18n( $num_trackbacks ) ); ?></h3>
<ul id="trackbacklist">
<?php foreach ( (array) $comments as $comment ) : ?>
<?php if ( 'comment' != get_comment_type() ) : ?>
<li>
<h5><?php comment_author_link(); ?></h5>
<em>on <?php comment_date(); ?></em>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment