-
-
Save dbernar1/4516259 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 call the content | |
*/ | |
function front_page_slider() { | |
/** | |
* The content we want to show | |
*/ | |
$loadme = '<p>sample sentence</p>'; | |
echo $loadme; | |
die(); | |
} | |
add_action('wp_ajax_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