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
Add a comment  | 

1 Answer 1

Reset to default 0

You 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