Skip to content

Commit accd14e

Browse files
authored
Merge pull request #2 from creativecommons/new-logged-template
add content template so only logged in users can access that page
2 parents 436e678 + 9d28ae8 commit accd14e

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

template-logged-in.php

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
/* Template Name: Logged in content page */
3+
get_header();
4+
the_post();
5+
?>
6+
<section class="main-content">
7+
<div class="grid-container">
8+
<div class="grid-x grid-padding-x align-center">
9+
<div class="cell large-8 medium-8">
10+
<header class="entry-header page-header">
11+
<h1 class="entry-title"><?php the_title() ?></h1>
12+
</header>
13+
<section class="entry-content page-content">
14+
<?php
15+
if ( is_user_logged_in() ) {
16+
the_content();
17+
} else {
18+
echo '<div class="callout warning">';
19+
echo '<h5 class="title">Sorry</h5>';
20+
echo '<p>You have to be logged in to see this content</p>';
21+
echo '</div>';
22+
}
23+
?>
24+
</section>
25+
</div>
26+
</div>
27+
</div>
28+
</section>
29+
<?php get_footer(); ?>

0 commit comments

Comments
 (0)