首页 > 解决方案 > 仅通过 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'); 

有办法吗

标签: javascriptajaxwordpress

解决方案


推荐阅读