<?php
/********用户收藏页面********/
if(!is_user_logged_in()) {
	wp_redirect(site_url()."/wp-login.php");
	exit;
}
global $current_user,$userdata;
get_currentuserinfo();
$pagenum = isset( $_GET['pagenum'] ) ? intval( $_GET['pagenum'] ) : 1;
$now = ($pagenum-1)*20;
$total = get_user_fav_count($userdata->ID);
$total_page = ceil($total/20);
?>
<h2>总共收藏<?php echo $total;?>篇文章</h2>
<ul class='single-resources-features'>
<?php $check= "select * from ".$wpdb->prefix."userpost_fav where user='$userdata->ID' limit $now ,20";
$coo = $wpdb->get_results($check);
if(count($coo) > 0){
foreach ($coo as $co) {
$post_of_int=get_post($co->post);
?> 
<li><a href="<?php echo get_permalink($post_of_int->ID); ?>">
<?php echo $post_of_int->post_title;?>
</a>
</li>
<?php }} ?>
</ul>
<?php
$pagination = paginate_links( array(
	'base' => add_query_arg( 'pagenum', '%#%' ),
	'format' => '',
	'prev_text' => '上一页',
	'next_text' => '下一页',
	'total' => $total_page,
	'current' => $pagenum
	)
);
if ( $pagination ) {
	echo $pagination;
}
?>