Get post content and show it in a div

OK, I managed to make it work, here’s how i did : Jquery part : jQuery(“.post-link”).click(function(){ var post_id = jQuery(this).data(‘id’); jQuery.post( ajaxurl, { ‘action’: ‘load_post_content’, ‘the_ID’: post_id }, function(response){ jQuery(‘#the-post-content’).html(response); } ); return false; }); And the function.php part : add_action( ‘wp_ajax_load_post_content’, ‘load_post_content’ ); add_action( ‘wp_ajax_nopriv_load_post_content’, ‘load_post_content’ ); function load_post_content() { $the_post_id = $_POST[‘the_ID’]; $args … Read more

Shortcode to pull posts

UPDATE Turns out the issue was with the first page of posts. I needed to account for page 1 when calling the ajax load more. Since this is a shortcode and not a template my query vars were not passing along to the ajax call. I resolved the issue by passing the page as a … Read more

How to check nonce lifetime value of plugins?

Check codex info about Nonces life time here. Here is a quick code that will echo life time of nonces in footer of your site’s front-end as html comment. Put it in your functions.php file. $n = “”; add_filter(‘nonce_life’, ‘wptuts_change_nonce_hourly’); function wptuts_change_nonce_hourly( $nonce_life ) { global $n ; $n = $nonce_life; return $nonce_life; } // … Read more