javascript - 仅通过 ajax 加载 Wordpress shourcode 没有 jquery
问题描述
在WordPress页面中创建pluing并使用shourtcode仅通过ajax加载而没有jquery,你能帮忙吗
短代码是
function shortcode_custome_post(){
$args = array(
'posts_per_page' => 2,
'post_type' => 'publication'
);
$ourPosts= get_posts($args);
$content="";
foreach($ourPosts as $key =>$val){
$content.= "<p><a href='".get_permalink($val->ID)."'>".$val->post_title."</a></p><br />";
$content.= "<p>".$val->post_content."</p><br />";
$content.="<hr />";
}
return $content;
}
add_shortcode('shortcode_custome_post','shortcode_custome_post');
有办法吗
解决方案
推荐阅读
- react-hooks - 渲染的钩子比上一次渲染时更多
- python - 在 Python 中使用 Selenium 和 Browsermob-Proxy 进行抓取时如何使用代理 IP?
- java - Lombok注解:合并后编译失败
- amazon-web-services - 无服务器部署失败
- jquery - 如何使用 $(this) 在附加的类上发生点击事件;
- django - 如何在detailview中获取主键并用于预填充表单中的隐藏字段?
- php - 为特定用户显示单个资源
- javascript - 如何遍历数组中的值以匹配对象中的值并返回相应的对象?
- macos - MacOS 公证和第三方库
- python - mpi4py (setup.py) 的构建轮...安装 stable_baselines 时出现错误消息