Help with WPDataAccess
-
I am trying to write code snippet using wpcode to generate and execute a wpdataaccess shortcode based on the value of a variable. I can get the code to generate the shortcode and it prints out on the page, but doesn’t get executed. Perhaps, there is a better way to approach this issue.
Here is the CODE snippet executing as javascript: src="https://code.jquery.com/jquery-1.12.0.min.js" type="text/javascript" const queryString = window.location.search; console.log(queryString); const urlParams = new URLSearchParams(queryString); const stage_passed = urlParams.get('url_stage') console.log("stage passed is: " + stage_passed); // code I am testing // function getParameterByName( name ){ name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regexS = "[\\?&]"+name+"=([^&#]*)"; var regex = new RegExp( regexS ); var results = regex.exec( window.location.href ); if( results == null ) return ""; else return decodeURIComponent(results[1].replace(/\+/g, " ")); } // const stage2_passed = getParameterByName('url_stage'); console.log("stage 2 passed: " + stage2_passed); // sessionStorage.setItem("url_stage", stage2_passed); const stage3_passed = sessionStorage.getItem("url_stage") console.log("session storage contents of url_stage: " + stage3_passed); // // // code to set correct shortcode for table processing // // const stage_to_use = sessionStorage.getItem("url_stage") // var stage_1 =
[wpdataaccess pub_id="1" filter_field_name="stage,input" filter_field_value="1,y"]
; // var stage_2 =[wpdataaccess pub_id="1" filter_field_name="stage,input" filter_field_value="2,y"]
; // var stage_3 =[wpdataaccess pub_id="1" filter_field_name="stage,input" filter_field_value="3,y"]
; // var stage_4 =[wpdataaccess pub_id="1" filter_field_name="stage,input" filter_field_value="4,y"]
; // var stage_5 =[wpdataaccess pub_id="1" filter_field_name="stage,input" filter_field_value="5,y"]
; // if (stage_to_use == "1") { document.write([wpdataaccess pub_id="1" filter_field_name="stage,input" filter_field_value="1,y"]
); }; if (stage_to_use == "2") { document.write([wpdataaccess pub_id="1" filter_field_name="stage,input" filter_field_value="2,y"]
); }; if (stage_to_use == "3") { document.write([wpdataaccess pub_id="1" filter_field_name="stage,input" filter_field_value="3,y"]
); }; if (stage_to_use == "4") { document.write([wpdataaccess pub_id="1" filter_field_name="stage,input" filter_field_value="4,y"]
); }; if (stage_to_use == "5") { document.write([wpdataaccess pub_id="1" filter_field_name="stage,input" filter_field_value="5,y"]
); }; console.log("ERROR - stage_to_use is not between 1-5"); Here is the output: Below generated by code snippet, but need it to execute too. This shows where it should on the page. [wpdataaccess pub_id="1" filter_field_name="stage,input" filter_field_value="4,y"]email is: [email protected]
The page I need help with: [log in to see the link]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Help with WPDataAccess’ is closed to new replies.