Skip to content

Instantly share code, notes, and snippets.

@asuh asuh/frontend.php forked from dbernar1/frontend
Last active Dec 11, 2015

Embed
What would you like to do?
// .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
You can’t perform that action at this time.