get value from selected input

Well, I don’t know how many input type of radios and checkboxes you have, but this should get you want you need: $(document).ready(function() { $(‘input:radio’).change(function() { // get the value var newValue = $(this).val(); // Update the div.score $(‘div.score’).text(newValue); }); }); PS: Your radio input need to have the same name, if you do not … Read more

passing values from functions.php to template

You could get your get_publications functions to return a JSON object with all sorts of information you need. e.g function get_publications() { // Your query here. $data = [ ‘html’ => $your_html, ‘found_posts’ => $query->found_posts, ‘current_post’ => $query->current_post, ‘current_page’ => $page, etc… ]; echo json_encode($data); } And then parse that data with your javascript.

Script not loading when depending on jQuery

You could run a couple checks and enqueue jquery if it’s not registered or enqueued using wp_script_is function bootstrap_script_init() { // Check to see if jQuery is registered, if not, register it. // You can use the local version of WP’s jQuery if you want instead of Google’s API. if ( !wp_script_is( ‘jquery’, ‘registered’ ) … Read more

Api external with wordpress

WordPress itself can communicate with external API’s through wp_remote_get and wp_remote_post. See the codex. In your case, you could create a page template called page-search.php (keep in mind that search.php is reserved for the internal WordPress search functionality, so you would define it as a template, and select it when creating the page), and run … Read more

Issues loading Jquery on WordPress website

Don’t enqueue your own version of jQuery. You’re just going to cause conflict issues with other plugins and there’s nothing in your script that requires a different version. Even if you were, just load the https:// version, there’s no reason to bother checking what your own server is doing. Don’t bother checking !is_admin() on your … Read more

Call current post URL in ajax

you can retrieve the permalink of the current post in JavaScript with wp_localize_script. juste try this code after the call of wp_enqueue_script wp_localize_script( “script_id” , “object” , [ “permalink” => get_post_permalink($post), ] ); and then you can read the permalink in JavaScript in object[“permalink”]

Admin-ajax php not working on new wordpress version

I previously thought that the issue was ajax/javascript related but it only seemed that way because the ajax script was not receiving any data. After inspection I saw that my query was returning 0 values. It turned out to be an issue of wp_queries breaking when using meta_query combined with the repeater format of Advanced … Read more