Advertisement
Guest User

Untitled

a guest
Sep 5th, 2016
1,779
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.25 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * Template Name: Page
  5. * Description: Standard Page Template
  6. *
  7. */
  8. get_header(); ?>
  9.  
  10. <!-- Standard Page Layout
  11. ================================================== -->
  12.  
  13. <section id="single">
  14. <div class="container">
  15. <div class="row">
  16. <div class="nine columns">
  17. <h2 class="page-title"><?php the_title(); ?><?php if(is_page('members-area')) { ?><span><a href="<?php echo wp_logout_url(home_url('/')); ?>">[logout]</a></span><?php } ?></h2>
  18. <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
  19. <article id="page-<?php the_ID(); ?>" <?php post_class('page'); ?>>
  20. <?php the_content(); ?>
  21.  
  22. <?php if(is_page('the-fueller')) { ?>
  23. <?php if(have_rows('issues')) {
  24. $total = count(get_field('issues')); ?>
  25. <h4>The Latest Issues</h4>
  26. <div class="magazine">
  27. <?php
  28. $number = 4; // the number of rows to show
  29. $count = 0; // a counter
  30. while(have_rows('issues')) {
  31. the_row(); ?>
  32. <div class="issue">
  33. <span><i class="fa fa-file" aria-hidden="true"></i></span>
  34. <span><strong><?php the_sub_field('issue_name'); ?></strong><br/><a href="<?php the_sub_field('pdf'); ?>" download="<?php the_sub_field('issue_name'); ?>" title="<?php the_sub_field('issue_name'); ?>">Download</a></span>
  35. </div>
  36. <?php
  37. $count++;
  38. if ($count == $number) {
  39. // we've shown the number, break out of loop
  40. break;
  41. }
  42. } // endwhile ?>
  43. </div>
  44. <a id="my-repeater-show-more-link" href="javascript: my_repeater_show_more();"<?php
  45. if ($total < $count) {
  46. ?> style="display: none;"<?php
  47. } ?>>Show More</a>
  48. <script type="text/javascript">
  49. var my_repeater_field_post_id = <?php echo $post->ID; ?>;
  50. var my_repeater_field_offset = <?php echo $number; ?>;
  51. var my_repeater_field_nonce = '<?php echo wp_create_nonce('my_repeater_field_nonce'); ?>';
  52. var my_repeater_ajax_url = '<?php echo admin_url('admin-ajax.php'); ?>';
  53. var my_repeater_more = true;
  54.  
  55. function my_repeater_show_more() {
  56.  
  57. // make ajax request
  58. jQuery.post(
  59. my_repeater_ajax_url, {
  60. // this is the action we set up in PHP
  61. 'action': 'my_repeater_show_more',
  62. 'post_id': my_repeater_field_post_id,
  63. 'offset': my_repeater_field_offset,
  64. 'nonce': my_repeater_field_nonce
  65. },
  66. function (json) {
  67. // add content to container
  68. jQuery('.magazine').append(json['content']);
  69. console.log('fired');
  70. // update offset
  71. my_repeater_field_offset = json['offset'];
  72. // see if there is more, if not then hide the more link
  73. if (!json['more']) {
  74. jQuery('#my-repeater-show-more-link').css('display', 'none');
  75. }
  76. },
  77. 'json'
  78. );
  79. }
  80. </script>
  81. <?php } // endif ?>
  82. <?php } ?>
  83. </article>
  84. <?php endwhile; endif; ?>
  85. </div>
  86. <aside id="sidebar" class="three columns">
  87. <?php get_sidebar('main'); ?>
  88. </aside>
  89. </div>
  90. </div>
  91. </section>
  92.  
  93. <!-- Footer
  94. ================================================== -->
  95.  
  96. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement