Shortcode in a custom post in custom query
-
Hi everyone!
I have a custom shortcode that works perfect in default page template but I have a custom page template with a custom query:
$loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); ... endwhile;I know about the function do_shortcode:
echo do_shortcode( '[shortcode foo="inscript"]' );But the problem is that I cannot pass that foo parameter/variable from the page visual/text editor. That foo parameter can be only retrieved from my custom php file as above.
I can replace the query with the default query:
while ( have_posts() ) : the_post(); ... endwhile;but that breaks everything because I am using a custom theme.
I will appreciate any advice – also where I might be looking into more.
The topic ‘Shortcode in a custom post in custom query’ is closed to new replies.