admin管理员组文章数量:1290309
I'm rather new in Wordpress developing and here is what I'm trying to do.
I've developed a plugin that retrieves and displays a very few details from JSON objects on a Wordpress page via a shortcode, a kind of list. I want to get more details from each item in the list on a single page when clicking on the items. So that I can get a dynamic page which could display more data from every single object of the list through a get parameter. The get parameter would be the object ID so that I can query it from my JSON source. I don't know if I make myself clear =/
How can I achieve this?
Thanks
I'm rather new in Wordpress developing and here is what I'm trying to do.
I've developed a plugin that retrieves and displays a very few details from JSON objects on a Wordpress page via a shortcode, a kind of list. I want to get more details from each item in the list on a single page when clicking on the items. So that I can get a dynamic page which could display more data from every single object of the list through a get parameter. The get parameter would be the object ID so that I can query it from my JSON source. I don't know if I make myself clear =/
How can I achieve this?
Thanks
Share Improve this question edited Jul 28, 2018 at 14:24 Johansson 15.4k11 gold badges43 silver badges79 bronze badges asked Jul 28, 2018 at 12:20 PierrePierre 253 bronze badges 1- @Piere Could you please share your repo link for the solutions you achieved for this? – Tiaan Nagel Commented Jun 17, 2021 at 13:57
1 Answer
Reset to default 0You need javascript code that make ajax request (after click on item from list) and display data from response.
You will need also function that receive object ID from request and prepare response. Add function to action hook wp_ajax_nopriv_my_action
add_action( 'wp_ajax_nopriv_my_action', 'my_action' );
function my_action() {
$output = '';
if ( isset($_POST['object_id'] ) {
// prepare output
}
echo json_encode($output);
wp_die();
}
ajax in WP
本文标签: plugin developmentGenerate dynamic page through data from another page
版权声明:本文标题:plugin development - Generate dynamic page through data from another page 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741497294a2381890.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论