I ask this question as a follow-up to this one.
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 should be translated into a query-shortcode?
$posts = get_posts(array(
if ($posts && count($posts)>0)
foreach ($posts as $post)
the_title(); //prints out the title of this post
Read more here:: How to write a query-function as a query-shortcode?