KevinBertrand
Forum Replies Created
Viewing 2 replies - 1 through 2 (of 2 total)
-
Forum: Plugins
In reply to: [Comments - wpDiscuz] How do i use wpDiscuz in posts loop ?Hi,
Indeed it work very well in a loop, i was wrong. It was a theme’s issue.
However i try to display more posts in ajax with a load more function :// Add button more posts add_action('wp_ajax_load_more_posts', 'load_more_posts'); function load_more_posts(){ $offset = json_decode( stripslashes( $_POST['offset'] ), true ); $posts = new WP_Query( 'offset='.$offset.'&posts_per_page=5' ); $GLOBALS['wp_query'] = $posts; if( ! $posts->have_posts() ) { get_template_part( 'content', 'none' ); } else { while ( $posts->have_posts() ) { $post = the_post(); $html = ''; $html .= '<article id="post-'.get_the_ID().'" class="'; $html .= implode(' ', get_post_class( 'cf' )); $html .= '" role="article"> <div class="row ml0 mr0"> <header class="article-header"> <div class="row mr0 ml0"> '.get_avatar( get_the_author_meta( 'ID' ), 32 ).' <h3><span class="entry-author author" itemprop="author" itemscope itemptype="https://schema.org/Person">'.get_the_author_link( get_the_author_meta( 'ID' ) ).'</span></h3> <time class="updated entry-time" datetime="'.get_the_time('Y-m-d').'" itemprop="datePublished">'.get_the_time(get_option('date_format')).'</time> </div> <h3 class="h2 entry-title"><a href="#" rel="bookmark" title="'.get_the_title().'">'.get_the_title().'</a></h3> </header> <section class="entry-content cf"> '.get_the_content().' </section> <footer class="article-footer cf"> <ul class="attached-medias">'; foreach(get_attached_media( 'image' ) as $k => $v): $html .= '<li><a href="'.$v->guid.'" class="pop-img"><img src="'.$v->guid.'" alt=""/></a></li>'; endforeach; $html .= '</ul> </footer> </div> <div class="row ml0 mr0"> <div id="comments-wrap"> <!-- Need wpDiscuz comment here --> <!-- Does not work : global $withcomments; $withcomments = 1; comments_template( "comments.php", true ); --> </div> </div> </article>'; echo $html; } } die(); }
And i don’t know, how to get wpDiscuz comments from my functions.php file.
Any ideas ?
Thanks for your help ?? ( and sorry for my english, i hope it’s ok )Forum: Plugins
In reply to: [Comments - wpDiscuz] How do i use wpDiscuz in posts loop ?I have added that :
<div id="comments-wrap"> <?php global $withcomments; $withcomments = 1; comments_template( 'comments.php', true ); ?> </div>
in my custom template page inside my posts loop
And “comments.php” is the default bones template comments which is override by wpDiscuz.
Viewing 2 replies - 1 through 2 (of 2 total)