Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * Template Name: Page
- * Description: Standard Page Template
- *
- */
- get_header(); ?>
- <!-- Standard Page Layout
- ================================================== -->
- <section id="single">
- <div class="container">
- <div class="row">
- <div class="nine columns">
- <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>
- <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
- <article id="page-<?php the_ID(); ?>" <?php post_class('page'); ?>>
- <?php the_content(); ?>
- <?php if(is_page('the-fueller')) { ?>
- <?php if(have_rows('issues')) {
- $total = count(get_field('issues')); ?>
- <h4>The Latest Issues</h4>
- <div class="magazine">
- <?php
- $number = 4; // the number of rows to show
- $count = 0; // a counter
- while(have_rows('issues')) {
- the_row(); ?>
- <div class="issue">
- <span><i class="fa fa-file" aria-hidden="true"></i></span>
- <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>
- </div>
- <?php
- $count++;
- if ($count == $number) {
- // we've shown the number, break out of loop
- break;
- }
- } // endwhile ?>
- </div>
- <a id="my-repeater-show-more-link" href="javascript: my_repeater_show_more();"<?php
- if ($total < $count) {
- ?> style="display: none;"<?php
- } ?>>Show More</a>
- <script type="text/javascript">
- var my_repeater_field_post_id = <?php echo $post->ID; ?>;
- var my_repeater_field_offset = <?php echo $number; ?>;
- var my_repeater_field_nonce = '<?php echo wp_create_nonce('my_repeater_field_nonce'); ?>';
- var my_repeater_ajax_url = '<?php echo admin_url('admin-ajax.php'); ?>';
- var my_repeater_more = true;
- function my_repeater_show_more() {
- // make ajax request
- jQuery.post(
- my_repeater_ajax_url, {
- // this is the action we set up in PHP
- 'action': 'my_repeater_show_more',
- 'post_id': my_repeater_field_post_id,
- 'offset': my_repeater_field_offset,
- 'nonce': my_repeater_field_nonce
- },
- function (json) {
- // add content to container
- jQuery('.magazine').append(json['content']);
- console.log('fired');
- // update offset
- my_repeater_field_offset = json['offset'];
- // see if there is more, if not then hide the more link
- if (!json['more']) {
- jQuery('#my-repeater-show-more-link').css('display', 'none');
- }
- },
- 'json'
- );
- }
- </script>
- <?php } // endif ?>
- <?php } ?>
- </article>
- <?php endwhile; endif; ?>
- </div>
- <aside id="sidebar" class="three columns">
- <?php get_sidebar('main'); ?>
- </aside>
- </div>
- </div>
- </section>
- <!-- Footer
- ================================================== -->
- <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement