-
Notifications
You must be signed in to change notification settings - Fork 1
/
page-my-notes.php
56 lines (43 loc) · 1.81 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
55
56
<?php
if(!is_user_logged_in()) :
wp_redirect(site_url('/'));
else :
get_header();
while(have_posts())
{
the_post();
pageBanner();
?>
<div class="container container--narrow page-section">
<div class="create-note">
<h2>Create New Note</h2>
<input class="new-note-title" placeholder="Title">
<textarea class="new-note-body" placeholder="Youe 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 class="note-title-field" value="<?php echo str_replace('Private: ', '', esc_attr(get_the_title())); ?>" readonly>
<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 class="note-body-field" readonly><?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 }
endif;
get_footer();
?>