Guest User

Untitled

a guest
Oct 18th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.15 KB | None | 0 0
  1. <?php
  2. /**
  3. * @package WordPress
  4. * @subpackage Default_Theme
  5. * Template Name: Page
  6. */
  7.  
  8. get_header(); ?>
  9.  
  10. <?php
  11. global $post;
  12. if ( post_password_required( $post ) ) {
  13. ?>
  14.  
  15. <?php $fields = get_acf(); ?>
  16.  
  17. <script type="text/javascript">
  18. (function() {
  19.  
  20. window.onload = function() {
  21.  
  22. ...
  23.  
  24. }}
  25. )
  26. </script>
  27. <div id="map"></div>
  28.  
  29. <?php } else { ?>
  30. Not passworded
  31.  
  32.  
  33.  
  34. <?php if (have_posts()) : ?>
  35. <?php while (have_posts()) : the_post(); ?>
  36.  
  37. <?php endwhile; ?>
  38. <?php endif; ?>
  39.  
  40. <?
  41. } // Page isn't password-protected
  42. ?>
  43. <?php get_footer(); ?>
  44.  
  45. <?php
  46. /**
  47. * Template: Password-Protected
  48. */
  49. ?>
  50.  
  51. <?php
  52. /**
  53. * Template: Password-Protected
  54. */
  55. ?>
  56.  
  57. <?php get_header(); ?>
  58.  
  59. <div id="main">
  60.  
  61. <?php if (have_posts()) : ?>
  62. <?php while (have_posts()) : the_post(); ?>
  63.  
  64. <div id="map" style="width:100%; height:100%"></div>
  65.  
  66. <?php endwhile; ?>
  67. <?php endif; ?>
  68.  
  69. </div>
  70.  
  71. <?php get_sidebar(); ?>
  72.  
  73. <?php get_footer(); ?>
  74.  
  75. <?php
  76. /**
  77. * Template: Password-Protected
  78. */
  79. ?>
  80.  
  81. <?php get_header(); ?>
  82.  
  83. <div id="main">
  84.  
  85. <?php
  86. // Globalize $post
  87. global $post;
  88. // Test for password-protected page
  89. // Returns true if post is password-protected
  90. // and if the password doesn't match cookie
  91. if ( post_password_required( $post ) ) {
  92. ?>
  93. <p>
  94. CUSTOM CONTENT THAT DISPLAYS ONLY WHEN PAGE IS PASSWORD PROTECTED
  95. GOES HERE
  96. </p>
  97. <?php
  98. } else {
  99. // Page isn't password-protected
  100. ?>
  101.  
  102. <?php if (have_posts()) : ?>
  103. <?php while (have_posts()) : the_post(); ?>
  104.  
  105. <div id="map" style="width:100%; height:100%"></div>
  106.  
  107. <?php endwhile; ?>
  108. <?php endif; ?>
  109.  
  110. <?php } ?>
  111.  
  112. </div>
  113.  
  114. <?php get_sidebar(); ?>
  115.  
  116. <?php get_footer(); ?>
  117.  
  118. <?php
  119. /**
  120. * Template: Login-Required
  121. */
  122. ?>
  123.  
  124. <?php get_header(); ?>
  125.  
  126. <div id="main">
  127.  
  128. <?php
  129. // Globalize $post
  130. global $post;
  131. // Test for password-protected page
  132. // Returns true if post is password-protected
  133. // and if the password doesn't match cookie
  134. if ( ! is_user_logged_in() ) {
  135. ?>
  136. <p>
  137. CUSTOM CONTENT THAT DISPLAYS ONLY WHEN USER IS NOT LOGGED IN
  138. GOES HERE
  139. </p>
  140. <?php
  141. } else {
  142. // Page isn't password-protected
  143. ?>
  144.  
  145. <?php if (have_posts()) : ?>
  146. <?php while (have_posts()) : the_post(); ?>
  147.  
  148. <div id="map" style="width:100%; height:100%"></div>
  149.  
  150. <?php endwhile; ?>
  151. <?php endif; ?>
  152.  
  153. <?php } ?>
  154.  
  155. </div>
  156.  
  157. <?php get_sidebar(); ?>
  158.  
  159. <?php get_footer(); ?>
  160.  
  161. <?php
  162. global $post;
  163. if ( post_password_required( $post ) ) {
  164. ?>
  165.  
  166. <?php $fields = get_acf(); ?>
  167.  
  168. <script type="text/javascript">
  169. (function() {
  170.  
  171. window.onload = function() {
  172.  
  173. ...
  174.  
  175. }}
  176. )
  177. </script>
  178. <div id="map"></div>
  179.  
  180. <?php
  181. /**
  182. * @package WordPress
  183. * @subpackage Default_Theme
  184. * Template Name: Page
  185. */
  186.  
  187. get_header(); ?>
  188.  
  189. <?php
  190. global $post;
  191. if ( post_password_required( $post ) ) {
  192. ?>
  193. <p>THIS POST IS PASSWORD PROTECTED. PLEASE ENTER THE PASSWORD TO VIEW THIS POST.</p>
  194.  
  195. <?php
  196. } else {
  197. // No password required, or password has been entered
  198. ?>
  199.  
  200.  
  201. <?php $fields = get_acf(); ?>
  202.  
  203. <script type="text/javascript">
  204. (function() {
  205.  
  206. window.onload = function() {
  207.  
  208. ...
  209.  
  210. }}
  211. )
  212. </script>
  213. <div id="map"></div>
  214.  
  215.  
  216.  
  217. <?php if (have_posts()) : ?>
  218. <?php while (have_posts()) : the_post(); ?>
  219.  
  220. <?php endwhile; ?>
  221. <?php endif; ?>
  222.  
  223. <?
  224. } // Page isn't password-protected
  225. ?>
  226. <?php get_footer(); ?>
  227.  
  228. <?php
  229. /**
  230. * @package WordPress
  231. * @subpackage Default_Theme
  232. * Template Name: Page
  233. */
  234.  
  235. get_header(); ?>
  236.  
  237. <?php
  238. global $post;
  239. if ( post_password_required( $post ) ) {
  240. ?>
  241. <p>THIS POST IS PASSWORD PROTECTED. PLEASE ENTER THE PASSWORD TO VIEW THIS POST.</p>
  242.  
  243. <?php echo get_the_password_form(); ?>
  244.  
  245. <?php
  246. } else {
  247. // No password required, or password has been entered
  248. ?>
  249.  
  250.  
  251. <?php $fields = get_acf(); ?>
  252.  
  253. <script type="text/javascript">
  254. (function() {
  255.  
  256. window.onload = function() {
  257.  
  258. ...
  259.  
  260. }}
  261. )
  262. </script>
  263. <div id="map"></div>
  264.  
  265.  
  266.  
  267. <?php if (have_posts()) : ?>
  268. <?php while (have_posts()) : the_post(); ?>
  269.  
  270. <?php endwhile; ?>
  271. <?php endif; ?>
  272.  
  273. <?
  274. } // Page isn't password-protected
  275. ?>
  276. <?php get_footer(); ?>
  277.  
  278. global $post;
  279. if ( ! post_password_required( $post ) ) {
  280. // protected content
  281. } else {
  282. echo get_the_password_form();
  283. }
  284.  
  285. <?php
  286. /**
  287. * Template Name: Password-Protected
  288. */
  289. ?>
Add Comment
Please, Sign In to add comment