Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Khashayarp

    (@khashayarp)

    oh , i figured it out!

    <?php
      $args = array( 'status' => 'approve', 'post_type' => 'questions');
      $comments = get_comments($args);
      $true_comment_count = 0;
    
      foreach($comments as $comment) :
    ?>
    
    <?php $comment_type = get_comment_type(); ?>
    <?php if($comment_type == 'comment') { ?>
    <?php $true_comment_count = $true_comment_count +1; ?>
    <?php $comm_title = get_the_title($comment->comment_post_ID);?>
    <?php $comm_link = get_comment_link($comment->comment_ID);?>
    <?php $comm_comm_temp = get_comment($comment->comment_ID,ARRAY_A);?>
    <?php $comm_content = $comm_comm_temp['comment_content'];?>
    <div style="margin:10px;padding:5px;border-bottom:1px dashed #ebebeb;height:auto;">
    <div style="float:right;width:60px;margin-left:10px;" class="questions-page-2">
    <?php if ( function_exists( 'get_avatar' ) ) {
          echo get_avatar( $comment, 50);
       } ?>
    </div>
    <div style="float:left;width:500px;" class="questions-page-1">
    <h6 class="toggle"><a href="#" style="opacity: 1;"><?php echo $comm_title?></a></h6>
    
    <div class="toggle_content" style="display: block;">
    
    <div class="block"><a href="<?php echo($comm_link)?>" title=""><?php echo $comm_title?></a>
    </div>
    </div>
    </div>
    <div class="clearboth"></div>
    </div>
    <?php } ?>
    <?php if($true_comment_count == 5) {break;} ?>
    <?php endforeach;?>
    
    </div>
    Thread Starter Khashayarp

    (@khashayarp)

    i tried to figure it out but i didn’t find any paramater for orderby in wp query!
    anybody knows any plugin or code to do that?
    for example:

    $wp_query = new WP_Query( array ( 'post_type' => 'questions', 'posts_per_page' => '10', 'paged' => get_query_var( 'paged' ) , 'orderby' => 'recent_comments' ) );

    is it possible?

    [No bumping, thank you.]

    Thread Starter Khashayarp

    (@khashayarp)

    Thank you , i figured it out!

    in case if anybody faced this problem you could use this code :

    $wp_query = new WP_Query( array ( 'post_type' => 'questions', 'posts_per_page' => '5', 'paged' => get_query_var( 'paged' ) ) );

    and after the loop ends add this code :

    <?php posts_nav_link(); ?>

    Thread Starter Khashayarp

    (@khashayarp)

    it adds the pagination but when i click next page the content is same on every page!

Viewing 4 replies - 1 through 4 (of 4 total)