TODO: To change the footer's content go to Dr.Explain menu Options : Project Settings : HTML (CHM) Export : Setup HTML Template and Layout
Tạo sử lý ajax riêng
Một cách làm khác khi sử lý ajax là tạo file php riêng, điều này sẽ tránh load những thành phần không cần thiết hay chúng không bao giờ sử dụng cho ajax. Điều này giúp thời gian truy vấn nhanh hơn. Bạn chỉ cần nhúng môi trường Wordpress vào file và tạo tùy biến action.
Tùy biến action:
Xem đoạn code mẫu sau đây:
File: my_custom_ajax.php
<?php
//mimic the actuall admin-ajax
define('DOING_AJAX', true);
if (!isset( $_POST['action']))
die('-1');
//make sure you update this line
//to the relative location of the wp-load.php
require_once('../../../wp-load.php');
//Typical headers
header('Content-Type: text/html');
send_nosniff_header();
//Disable caching
header('Cache-Control: no-cache');
header('Pragma: no-cache');
/*Next we need to call the actual methods we want to invok*/