-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
singular-bookmarks.php
105 lines (80 loc) · 2.57 KB
/
singular-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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php
/**
* Template Name: Bookmarks
*
* Mostly empty page template that always renders the bookmarks partial
* even without any shortcode. Meant to be used as overview page for all
* the users bookmarks. You can still add regular content here but the
* point of that is highly debatable.
*
* @package WordPress
* @subpackage Fictioneer
* @since 4.6.0
*/
// Return home if bookmarks are disabled
if ( ! get_option( 'fictioneer_enable_bookmarks' ) ) {
wp_redirect( home_url() );
exit;
}
// Header
get_header( null, array( 'no_index' => 1 ) );
?>
<main id="main" class="main singular bookmarks-page">
<?php do_action( 'fictioneer_main', 'singular-bookmarks' ); ?>
<div class="main__wrapper">
<?php do_action( 'fictioneer_main_wrapper' ); ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php
// Setup
$title = trim( get_the_title() );
$breadcrumb_name = empty( $title ) ? fcntr( 'bookmarks' ) : $title;
$this_breadcrumb = [$breadcrumb_name, get_the_permalink()];
?>
<article id="singular-<?php the_ID(); ?>" class="singular__article">
<?php if ( ! empty( $title ) ) : ?>
<header class="singular__header">
<h1 class="singular__title"><?php echo $title; ?></h1>
</header>
<?php endif; ?>
<?php if ( get_the_content() ) : ?>
<section class="singular__content content-section">
<?php the_content(); ?>
</section>
<?php endif; ?>
<section>
<?php
get_template_part(
'partials/_bookmarks',
null,
array(
'show_empty' => true
)
);
?>
</section>
<footer class="singular__footer"><?php do_action( 'fictioneer_singular_footer' ); ?></footer>
</article>
<?php endwhile; ?>
</div>
<?php do_action( 'fictioneer_main_end', 'singular-bookmarks' ); ?>
</main>
<?php
// Get profile link
$profile_link = fictioneer_get_assigned_page_link( 'fictioneer_user_profile_page' );
$profile_link = $profile_link ? $profile_link : get_edit_profile_url();
// Footer arguments
$footer_args = array(
'post_type' => 'page',
'post_id' => get_the_ID(),
'breadcrumbs' => array(
[fcntr( 'frontpage' ), get_home_url()]
)
);
if ( is_user_logged_in() ) {
$footer_args['breadcrumbs'][] = [fcntr( 'account' ), $profile_link];
}
// Add current breadcrumb
$footer_args['breadcrumbs'][] = $this_breadcrumb;
// Get footer with breadcrumbs
get_footer( null, $footer_args );
?>