forked from AndorChen/V2Press
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpage-bookmarks.php
50 lines (44 loc) · 1.73 KB
/
page-bookmarks.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/**
* Template Name: Bookmarks
*
* This page template is for Bookmarks page only.
*
* @since 0.0.1
*/
if ( !is_user_logged_in() )
auth_redirect();
$user_id = get_current_user_id();
$bookmarked = get_user_meta( $user_id, 'v2press_i_bookmarked_topics', true );
if ( !is_array( $bookmarked) )
$bookmarked = array();
$count = count( $bookmarked );
get_header(); ?>
<div id="main">
<section id="bookmarks-page-box" class="box">
<div class="heading">
<p class="xsmall fade"><?php vp_breadcrumb(); ?></p>
</div>
<div class="inner">
<?php if ( 0 < $count ) :
$bm_query = new WP_Query( array( 'post__in' => $bookmarked ) );
if ( $bm_query->have_posts() ) :
$i = 0;
?>
<ul class="zebra-topics-list">
<?php while ( $bm_query->have_posts() ) : $bm_query->the_post(); $i++; ?>
<li id="topic-<?php the_ID(); ?>"<?php if ( 0 == $i%2 ) echo ' class="alt"'; ?>><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" rel="bookmark"><?php the_title(); ?></a></li>
<?php endwhile; ?>
</ul>
<?php endif; // END if $bm_query->have_posts() ?>
<?php else: ?>
<h2 class="xlarge fade center"><?php _e( 'You have not bookmarke any topics yet.', 'v2press' ); ?></h2>
<?php endif; // END if 0 < $count ?>
</div>
<div class="footing">
<p class="xsmall fade"><?php printf( _n( '%d bookmark in total.', '%d bookmarks in total.', $count, 'v2press' ), $count); ?></p>
</div>
</section>
</div><!--END #main-->
<?php get_sidebar(); ?>
<?php get_footer(); ?>