Posts

Showing posts from July, 2020

Wordpress Ajax

How to create a wordpress ajax with easiest Example without plugin! Wordpress Ajax is used to show the content without page load. Actually some time web page occur lengthy and user have to scroll down the page again and again to see more content on page load so this situation make the user irritate and to avoid this type of problem we have a solution which called Wordpress Ajax. Let's see how wordpress ajax works? Here are 2 actions that used in Wordpress Ajax are wp_ajax_nopriv and wp_ajax.  wp_ajax  hook allows you to create custom handlers for your own custom AJAX requests. This only fires for logged-in users . If you need to also listen for Ajax requests that don’t come from logged-in users:    wp_ajax_nopriv   hook is functionally the same as wp_ajax, however it is used to handle AJAX requests on the front-end for unauthenticated users . Syntax: add_action('wp_ajax_nopriv_action_name', 'action_function'); add_action('wp_ajax_action_name', ' action_f...

Wordpress Shortcodes

How to create a Shortcode in wordpress with easiest Example without plugin! Wordpress Shortcode works in same way as shortcut,  to call large functionality in a smallest way. In the other words, it helps you to show large functionality in smallest calling as with as write code one time instead of writing code multiple times to show specific functionality on different pages.  So means it saves time. For example :  If you want to show posts listing with different Post Types on different locations, you will create a shortcode with a parameter where you will pass a Post Type Name. Lets see how we will create a shortcode with one time coding and multiple times calling with different post time name and parameter. Syntax : add_shortcode('kamra_shortcode-name', 'kamra_shortcode_function'); function kamra_shortcode_function(){}