ajax, right way to do it and make it works?
In your functions.php file you should add an action to enqueue your scripts. <?php function my_enqueue_scripts() { wp_enqueue_script( ‘load_post’, get_template_directory_uri() . ‘/js/load_post.js’, array( ‘jquery’ ), ‘1.0’, 1 ); wp_localize_script( ‘load_post’, ‘wp_ajax’, array( ‘url’ => admin_url( ‘admin-ajax.php’ ), ‘nonce’ => wp_create_nonce( ‘ajax_nonce’ ) ) ); } add_action( ‘wp_enqueue_scripts’, ‘my_enqueue_scripts’ );