Questions tagged «shortcode»

5
如何在WordPress简码中使用AJAX?
我有一个显示随机报价的代码。一个人编写了一个函数来实现所有这些功能。但是由于某种原因通过AJAX进行的更新数据不起作用。当您按下按钮“ New Quote”时,什么也没有发生。也许有人知道为什么?以下代码中需要解决的问题,以便在单击“新报价”时加载新的报价? 的PHP /wp-content/themes/%your_theme%/js/ajax-load-quote.php <?php /* uncomment the below, if you want to use native WP functions in this file */ // require_once('../../../../wp-load.php'); $array = file( $_POST['file_path'] ); // file path in $_POST, as from the js $r = rand( 0, count($array) - 1 ); return '<p>' . $array[$r] …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.