@daisha
To pass a field from a WordPress plugin into an iframe, you can use JavaScript to retrieve the value of the field and dynamically update the src
attribute of the iframe. Here is an example code snippet to demonstrate how you can achieve this:
1
|
<iframe id="myIframe" width="100%" height="400"></iframe> |
1 2 3 4 5 6 7 8 9 10 |
<script> // Retrieve the field value from the WordPress plugin var fieldValue = '<?php echo get_field("your_field_name"); ?>'; // Get the iframe element var iframe = document.getElementById('myIframe'); // Set the src attribute of the iframe with the field value iframe.src = 'https://example.com/your-page?field=' + fieldValue; </script> |
Replace 'your_field_name'
with the actual name of the field in your WordPress plugin. This code snippet will dynamically update the src
attribute of the iframe with the field value when the page loads.
Please note that the above code should be added to the WordPress page template or post content where you want to display the iframe. Additionally, you may need to adjust the code to fit your specific plugin and iframe implementation.