Shortcode in a custom post in custom query (1 post)

  1. Borkoff
    Posted 2 years ago #

    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();

    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();

    but that breaks everything because I am using a custom theme.

    I will appreciate any advice - also where I might be looking into more.

Topic Closed

This topic has been closed to new replies.

About this Topic