Ajax in wordpress [duplicate]

Write below code in functions.php of your active theme <script type=”text/javascript” > jQuery(document).ready(function($) { var data = { ‘action’: ‘get_data’, ‘testparam’:’hello’ //optional to pass any extra param }; $.ajax(ajaxurl, data, function(response) { alert(‘Response: ‘ + response); //Append response in your result wrapper }); }); </script> <?php add_action( ‘wp_ajax_get_data’, ‘get_data_ajax_func’ ); function get_data_ajax_func() { global $wpdb; … Read more

List archive year – post by post

Here is a strip down of something similar I’ve done a while ago. Here is what the code basically does is: First, it retrieves the date of the first post on the block. Secondly, the current date is retrieved. These two values are fed into a range() function to get all years in between A … Read more

How to make diferent post formats for different pages?

You will need to create either a child theme based on a current theme you are already using, or develop your own custom theme. Within your theme, you’ll have complete control over the layouts used for single posts and category pages (knowns as archives). A great place to start is with the WordPress documentation at … Read more