Output loop leveraged shortcode twice on one page

Not sure I understand what you are doing with your shortcode, but I think you need to run rewind_posts() to move the loop counter back to the beginning for the second “execution.” Example here: https://codex.wordpress.org/Function_Reference/rewind_posts further explanation here: https://stackoverflow.com/questions/23729847/wordpress-difference-between-rewind-posts-wp-reset-postdata-and-wp-reset-q

Scripts for shortcode: concatenate or load separately? [closed]

Why get into too much mess? Why not just look for your shortcode in content and widgets and then decide whether to enqueue a script/style or not. Use this code to see if your shortcode is being used or not. function check_shortcode($text) { $pattern = get_shortcode_regex(); if ( preg_match_all( “https://wordpress.stackexchange.com/”. $pattern .’/s’, $text, $matches ) … Read more

Creating own shortcode – echoeing php variable based on JS variable

You can’t add logic for changing in that way. You need react on user “front-end” event with js. Also this construction will work wrong: document.getElementById(\”form\”).innerHTML = \”[contact-form-7 id=\”formId\”]\”; Will be always print [contact-form-7 id=\”formId\”], because js can’t do_shortcode function itself. If you wanna make it simple(without ajax process) you need: 1) Print all forms with … Read more