I ask this question as a follow-up to [this one][1].

I have this query-function in `functions.php` but AAMOF I don't want to change `functions.php` at all (besides for CPTs).

I'd like to print the same data directly from WP GUI via shortcode.

How should a `functions.php` query-function be translated into a query-shortcode?

    $posts = get_posts(array(
        "post_type"=>"book_pages",
        "post_status"=>"publish",
        "posts_per_page"=>-1 
    ));
    
    if ($posts && count($posts)>0) 
    {
        global $post;
        foreach ($posts as $post)
        {
            setup_postdata($post);
            the_title(); //prints out the title of this post
        }
        wp_reset_postdata(); 
    }


  [1]: https://wordpress.stackexchange.com/questions/312795/how-to-print-all-posts-of-a-given-post-type-cpt-in-a-given-webpage