-
-
Save asuh/4516188 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// .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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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