Here is my Custom Post Type
'supports' => array('premise-member-access', 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments'),
Comments enabled on settings->discussion
Comments enabled on lesson page
✓ Allow link notifications from other blogs (pingbacks and trackbacks)
✓ Allow people to post comments on new articles
With this code I still get comments closed
comments_template('/templates/comments.php');
Weirdly enough the comments are open on my localhost but only when I echo it on the top not when I put it in the bootstrap tabs
Please help need this in order to complete my MVP
http://competeleap.com/courses/keywords-spy-on-your-competitors/
Let me know if there is anything else that I should post in order to get help from you guys, thanks in advance.
cfx
July 1, 2014, 7:04pm
2
It looks like you’re trying to use comments_template()
before your post data gets setup by the loop.
Could you kindly point me to the type of basic loop that is needed where all I am spitting out is the comments for that page. Thanks for the quick response cfx…
The page I created is
single-lessons.php
<div class="row">
<ol class="breadcrumb">
<?php bcn_display(); ?>
</ol>
</div>
<?php
// Buttons
$prev_post = get_previous_post();
$next_post = get_next_post();
?>
<div class="row">
<?php if (!empty( $prev_post )): ?>
<a href="<?php echo get_permalink( $prev_post->ID ); ?>">
<button type="button" class="btn btn-default">
<span class="glyphicon glyphicon-chevron-left"></span>
<?php echo $prev_post->post_title; ?></button></a>
<?php endif; ?>
<?php if (!empty( $next_post )): ?>
<a href="<?php echo get_permalink( $next_post->ID ); ?>">
<button type="button" class="btn btn-primary pull-right">
<?php echo $next_post->post_title; ?>
<span class="glyphicon glyphicon-chevron-right"></span></button></a>
<?php endif; ?>
</div>
<?php
$video = get_field('video');
$summary = get_field('summary');
$tool = get_field('tool');
$tool_button = get_field('tool_button');
// Get Course Name
// $courseCurrent = the_terms( $post->ID, 'course' );
// echo "course name", the_terms( $post->ID, 'course' ), "<br>";
?>
<div class="row row-centered">
<div class="col-lg-7 col-centered">
<?php
if ( is_user_logged_in() ) {
if ( member_has_access_level($access_level = 'paid', $user_id = wp_get_current_user(), $delay = 0) ) {
echo $video;
}
} else {
?>
<h3 class="text-center">You Must <a href="<?php echo get_home_url(); ?>/login">Login</a> or <a href="<?php echo get_home_url(); ?>/pricing">Signup</a> to View This Video</h3>
<?php
}
?>
</div>
</div>
<div class="row">
<!-- Nav tabs -->
<ul class="nav nav-tabs">
<li class="active"><a href="#home" data-toggle="tab">Summary <span class="glyphicon glyphicon-inbox"></a></li>
<li><a href="#profile" data-toggle="tab">Further Research <span class="glyphicon glyphicon-paperclip"></span></a></li>
<li><a href="#messages" data-toggle="tab">Questions <span class="glyphicon glyphicon-comment"></span></a></li>
<!-- <li><a href="#settings" data-toggle="tab">Settings</a></li> -->
</ul>
<!-- Tab panes -->
<div class="tab-content" style="padding-top:10px;">
<div class="tab-pane active" id="home"><?php echo $summary; ?></div>
<div class="tab-pane" id="profile"><?php get_template_part('templates/content', 'page'); ?></div>
<div class="tab-pane" id="messages"><?php comments_template('/templates/comments.php'); ?></div>
<!-- <div class="tab-pane" id="settings">...</div> -->
</div>
</div>
I added a basic loop with comments in but no cigar:
<?php
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
comments_template('/templates/comments.php');
} // end while
} // end if
?>
cfx
July 1, 2014, 8:07pm
4
This is not specific to Roots so try a Google search or read through the WP Codex. A cursory search turned up this .
Hey cfx I am having absolutely no luck! I can see comments but I can’t reply. It works on single.php so I am at a loss any more help would be much appreciated. I also listed a question on wordpress.stackexchange but no luck.
cfx
July 9, 2014, 5:42pm
6
Ok, but “luck” aside, what have you tried ?
1 Like