Skip to content

Instantly share code, notes, and snippets.

View allenbell's full-sized avatar

Allen Bell allenbell

View GitHub Profile
@allenbell
allenbell / pagination.css
Created February 10, 2016 20:15
Ajax pagination for posts linked via ACF Relationships - CSS
.bike-features {
margin-bottom: 15px;
}
#bike-features-container {
min-height: 400px;
}
#bike-features-inner, #bike-options-inner {
visibility: hidden;
@allenbell
allenbell / pagination.js
Created February 10, 2016 20:14
Ajax pagination for posts linked via ACF Relationships - JavaScript
jQuery(document).ready(function($){
$(document).on( 'click touchstart', '#pagination a', function( event ) {
// Fade out the old content for a smooth transition
$('#bike-features-inner').fadeOut();
// The pagination button you clicked will pass the page number back to the callback function
var page = $(this).attr('href');
@allenbell
allenbell / pagination.php
Created February 10, 2016 20:10
Ajax pagination for posts linked via ACF Relationships
<?php
function ajax_pagination_enqueue() {
// Register and enqueue our javascript file
wp_register_script( 'pagination',
get_template_directory_uri() . '/library/js/pagination.js', // or wherever you put the file in your theme directory
array('jquery'));
wp_enqueue_script('pagination');