پرسش و پاسخ
[insert_php]
define(“DEFAULT_COMMENTS_PER_PAGE”,15);
$page = (get_query_var(“page”)) ? get_query_var(“page”) : 1;;
$limit = DEFAULT_COMMENTS_PER_PAGE;
$offset = ($page * $limit) – $limit;
$param = array(
“status”=>”approve”,
“offset”=>$offset,
“number”=>$limit,
);
$total_comments = get_comments(array(“orderby” => “post_date” ,
“order” => “DESC”,
“status” => “approve”));
$pages = ceil(count($total_comments)/DEFAULT_COMMENTS_PER_PAGE);
$comments = get_comments($param );
//Display the list of comments
wp_list_comments(array(
“per_page” => 10, //Allow comment pagination
“reverse_top_level” => false //Show the latest comments at the top of the list
), $comments);
//echo “
“;
$paginate_links = paginate_links($args1 );
if ($paginate_links) {
echo “
“;
}
echo “
ارسال پرسش
“;
comment_form();
[/insert_php]
$args1 = array(
“base” => @add_query_arg(“page”,”%#%”),
“format” => “?page=%#%”,
“total” => $pages,
“current” => $page,
“show_all” => False,
“end_size” => 1,
“mid_size” => 2,
“type” => “plain”,
“prev_next” => True,
“prev_text” => __(“قبل”),
“next_text” => __(“بعد”),
“add_args” => false,
“add_fragment” => “”
);
// ECHO THE PAGENATION
//echo paginate_links( $args1 );
//echo “