Using AJAX With WordPress

How to use AJAX with WordPress Here is the simple tutorial to do so. On Client Side (JAVASCRIPT) <script> $(document).on(‘click’, ‘.remove’, function(){ let url = “<?=admin_url(‘admin-ajax.php’)?>”; $.post(url, { action : “ajax_test”, id : “1”, }, function(data,status){ alert(“Data: ” + data + “\nStatus: ” + status); }); }) </script> On Server Side: (In Plugin or function.php […]

Read More

adding two time values of similar formats using php

Adding two time using php function sum_the_time($time1, $time2) { $times = array($time1, $time2); $seconds = 0; foreach ($times as $time) { list($hour,$minute,$second) = explode(‘:’, $time); $seconds += $hour*3600; $seconds += $minute*60; $seconds += $second; } $hours = floor($seconds/3600); $seconds -= $hours*3600; $minutes = floor($seconds/60); $seconds -= $minutes*60; if($seconds < 9) { $seconds = “0”.$seconds; } […]

Read More

Learn Dash Functions

Learn Dash Documentation 1. Learn Dash Functions a. Get user courses : learndash_user_get_enrolled_courses($user_id) b. Get Lessons id by course id : learndash_course_get_steps_by_type($course_id, ‘sfwd-lessons’) c. Get lesson list : learndash_get_lesson_list($course_id) d. Get Topics list : learndash_get_topic_list($lesson_id, $course_id); e. Check user access for course : ld_course_check_user_access($course_id, $user_id); //@returns true, false

Read More