Skip to content

Instantly share code, notes, and snippets.

@asuh
Forked from dbernar1/frontend
Last active December 11, 2015 00:19
Show Gist options
  • Save asuh/4516188 to your computer and use it in GitHub Desktop.
Save asuh/4516188 to your computer and use it in GitHub Desktop.
// .content contains content
<div class="content"></div>
<script>
$(document).ready(function() {
// ajax to fetch the slider data.
$.ajax({
type: 'POST',
url: '<?php echo admin_url("admin-ajax.php"); ?>',
data: { action: "front_page_slider" },
success: function(data) {
$('.content').html(data);
}
});
});
</script>
<?php
/**
* Function to data for front page slider
*/
function front_page_slider() {
global $post;
$real_post = $post;
$post = get_page( 8280 );
the_block( 'Introduction' );
$post = $real_post;
} // end theme_custom_handler
add_action('wp_ajax_dhf_front_page_slider', 'front_page_slider' );
add_action( 'wp_ajax_nopriv_front_page_slider', 'front_page_slider' );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment