-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpage-my-notes.php
54 lines (41 loc) · 1.76 KB
/
page-my-notes.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
<?php
if (!is_user_logged_in()) {
wp_redirect(esc_url(site_url('/')));
exit;
}
get_header();
while (have_posts()) {
the_post();
pageBanner();
?>
<div class="container container--narrow page-section">
<div class="create-note">
<h2 class="headline headline--medium">Create New Note</h2>
<input class="new-note-title" placeholder="Title">
<textarea class="new-note-body" placeholder="Your note here..."></textarea>
<span class="submit-note">Create Note</span>
<span class="note-limit-message">Note limit reached: delete an existing note to make room for a new one.</span>
</div>
<ul class="min-list link-list" id="my-notes">
<?php
$userNotes = new WP_Query(array(
'post_type' => 'note',
'posts_per_page' => -1,
'author' => get_current_user_id()
));
while ($userNotes->have_posts()) {
$userNotes->the_post(); ?>
<li data-id="<?php the_ID(); ?>">
<input readonly class="note-title-field" value="<?php echo str_replace('Private: ', '', esc_attr(get_the_title())); ?>">
<span class="edit-note"><i class="fa fa-pencil" aria-hidden="true"></i> Edit</span>
<span class="delete-note"><i class="fa fa-trash-o" aria-hidden="true"></i> Delete</span>
<textarea readonly class="note-body-field"><?php echo esc_textarea(get_the_content()); ?></textarea>
<span class="update-note btn btn--blue btn--small"><i class="fa fa-arrow-right" aria-hidden="true"></i> Save</span>
</li>
<?php }
?>
</ul>
</div>
<?php }
get_footer();
?>