我有一个函数,可以从管理页面获取数据,并在frontpage上显示结果。但仅在管理员用户登录时有效。即使用户未登录,如何显示结果?
这里是apoiadores中的代码。js公司
xhr.open("GET", "http://localhost/editora/wp-admin/edit.php?post_type=shop_order");
xhr.addEventListener("load", carregarapoiadores);
xhr.addEventListener("load", preco);
xhr.send();`
这里是函数中的代码。php
function apoiadores () {
wp_enqueue_script(\'apoiadores\', get_template_directory_uri() .
\'/chsv/js/apoiadores.js\', array(\'jquery\'), \'\', true);
}
add_action(\'wp_enqueue_scripts\', \'apoiadores\');
function prazo () {
wp_enqueue_script(\'prazo\', get_template_directory_uri() .
\'/chsv/js/prazofinal.js\', array(\'jquery\'), \'\', true);
}
add_action(\'wp_enqueue_scripts\', \'prazo\');`