Use menu link or onClick to set a variable

By this you can pass the value using ajax, you have fetch value from $_POST in your php script jQuery(document).ready(function(){ jQuery(‘.dayLink a’).click(function(){ var li_id = jQuery(this).closest(‘.dayLink’).attr(‘id’); jQuery.ajax({ url: ‘url_to_php_script’, data: {dayValue: li_id,action:call_to_ajax}, method: ‘POST’, success: function(res){ console.log(res); } }) }); }); The closing brackets were out of order. <?php if(isset($_GET[‘li_id’])){ $test = $_GET[‘li_id’]; echo $test; … Read more

Create onClick Event to Re-load a Widget

I think you something like this. HTML Add this in widget <a href=”https://wordpress.stackexchange.com/questions/254474/javascript:void(0)” id=”add_my_fav”>Add To Favourite<span id=”favCount”></span></a> Ajax Add this in template <?php $nonce = wp_create_nonce(‘addToFav’); ?> <script> jQuery(document).read(function(){ jQuery.ajax({ url: ‘http://example.com/wp-admin/admin-ajax.php’, data: {action:”add_to_favourite”, secret:”<?php echo $nonce; ?>”}, method: ‘POST’, success: function(res){ jQuery(‘#favCount’).html(res); } }) }) </script> PHP Add this in functions.php function addToFavourite(){ if(isset($_POST[‘secret’]) … Read more

Linking to the most recent post in a Custom Post Type

As long as Pods creates standard custom post types, you can simply update the arguments passed to WP_Query . The$post_type parameter will allow you to filter the results based on the specified post type (string) or post types (array). $latest = new WP_Query( array( ‘category_name’ => $request->query_vars[‘category_name’], ‘posts_per_page’ => 1, ‘post_type’ => array ( ‘post’, … Read more

How can I remove the search window?

I searched through all the files in the theme for the word “search” and tried removing that command from entry.php and entry-summary.php. None of that had an effect. I also tried removing the search.php file, that had no effect. To save you grief, any edits to the core files provided by WordPress will potentially break … Read more

Event-Driven Pattern vs MVC?

I will try to explain it simplest as i can: MVC Framework – Is a framework, that uses MVC software architectural pattern. This pattern sepatares logic in Controller, data in Models, and HTML code in Views. This 3 are separated in different files, so code is cleaner. Event Driven Pattern – Is a software architecture … Read more