You need to have an iterator that counts. I’m only including the foreach
loops:
<?php $data_i = 1; // set the iterator ?>
<?php foreach ( $repeatable_fields as $field ) { ?>
<li>
<a href="https://wordpress.stackexchange.com/questions/361395/javascript:void(0)" class="buttosn" data-server="<?php echo $data_i; ?>"><!-- <-- put the iterator here -->
<i class="fa fa-play-circle"></i>
<?php if($field['name'] != '') echo esc_attr( $field['name'] ); ?>
</a>
</li>
<?php $data_i++; //this is your iterator to count up. } ?>
Same here:
<?php $iframe_i = 1; ?>
<?php foreach ( $repeatable_fields as $field ) { ?>
iframes[<?php echo $iframe_i; ?>] = '<iframe width="100%" height="400" src="https://wordpress.stackexchange.com/questions/361395/<?php echo esc_attr( $field["url'] ); ?>" frameborder="0" allowfullscreen></iframe>';
<?php $iframe_i++; } ?>
Related Posts:
- Trying to retrieve post meta
- Most efficient way to add javascript file to specific post and/or pages?
- How to remove hardcoded characters from playlists?
- Conditionally loading JavaScript based on the Advanced Custom Fields in the post
- Understanding WordPress child theme custom JS loading
- Use different javascript files for each page on website
- Trigger popup in a php if/else statement
- How can I create a list of page titles from custom meta values?
- How to select the contents in the text view textrea in wp_editor?
- I have a problem in the order of enqueues while enqueuing stylesheets and scripts for a specific page in my function.php
- Two queries for a WP_User_Query search work perfectly apart, but not together
- Menu jumping when calling it via PHP
- Add / Update Custom Fields After Select Pictures in Media Window
- can i fetch a custom metabox data in another page or post type?
- Redirect to another page using contact form 7? [closed]
- How to add specific meta tags to head of cart and checkout pages in woocommerce?
- Saving zero in meta box
- Find a way to retrive data updated through metabox plugin to web page
- Why does this update_post_meta function not delete the custom field itself?
- Hide Heading if ACF Field is empty
- wp_nav_menu not working correctly in my underscores theme
- How to store multiple custom meta box
- Display background color or image with custom meta box?
- Ajax URLs without #!, how to prevent falling into single.php on load or reload?
- Meta boxes only displayed when editing normal (default wp post_type) posts
- security concerns if using html data-* attribute for l10n?
- How to extend SelectControl with data from my theme
- register dependency css and js inside a plugin class
- Collapsible menu on post sidebar only expands and does not collapse
- How to send Ajax Call from frontend without using wp_localize_script in Theme
- What syntax is this? “{{post.price}}”
- meta field for numerous links
- Custom fields changes the formatting of metabox input
- custom field meta-box with dropdown/autocomplete
- Help with my first Metabox helper class
- If custom field doesn’t exist, or exists and it’s true show title?
- Where can I find the code for the menu page meta boxes?
- PHP Puzzle: Unique Styles with PHP loop
- Display custom meta box in my template file
- Add a class to links in the visual editor (how to get old dialog back)
- WooCommerce: How to display item meta data in email confirmation using woocommerce_order_item_meta_end
- How to use multiple query with same meta key
- Get post meta in enqueued js file
- How to use WordPress (PHP) functions in AngularJS partials files?
- How to create a custom config file and get data using inline JS in a wordpress page
- Multiple do_shortcode($content) within one shortcode
- Widgets not showing in my custom theme
- Use ajax to update_post_meta
- Archive dropdown styling not applied
- What is the fastest way to load PHP functions that are only used in one theme template?
- How to make custom total price reactive in navigation
- Adding tawk.to code just before body tag on functions.php file
- Implement toggle switch for theme options in settings API
- tracking number field in Woocommerce order [closed]
- Creating a Multi-Level Associative Object Using AJAX
- remove wp floating submenu in wp dashboard
- search and replace preword from author
- How to complete two other input fields, completed the first
- Incorrect MIME type for assets with Valet
- How to edit widget code to add unique class name to each div?
- Generate sidebar depending on height of post
- Is the “_s” on this `sprintf(__(‘Page %s’, ‘_s’), max($paged, $page))` just refer to a text domain?
- Syntax error when I try to insert my loop into an unordered list? [closed]
- What exactly do this function declared into functions.php file of a WP theme?
- Royalty-Free Sliders used in theme development
- wordpress admin plugin menu custom css
- WordPress get_media_embedded
- Why i can’t get custom fields value or post ID via Ajax?
- Add editor toolbar to Metabox
- How to reference PHP in Javascript
- get db values for external js file
- Ajaxurl suddenly not defined
- the_meta – no get_the_meta query?
- html form: redirect page after form completes submit function and posts data
- Uncaught TypeError: extract(): Argument #1 ($array) must be of type array, null given
- Creating a brand attribute as a variable
- Header is not displaying on certain pages of wordpress theme [closed]
- Include custom fields in search
- update_term_meta() only updating once on certain meta keys
- Cannot find the php_ini configuration file to find my error log to see why my code is not working
- Add other class content with reference class value
- How do I integrate vanilla Javascript to a wordpress website?
- Generating 3 random numbers and saving them in database
- Looping through dummy posts and showing them in the main index.php
- Pulling Products from an API
- How to call a function from functions.php with ajax?
- Customizer: How to Sanitize a Decimal Number Range
- PHP code printed into CSS classes
- Get the image title and alt from custom query
- How to get the first letter from custom field?
- Meta box not saving spaces
- Why this plugin is not working?
- Trying to fix multiple category drop down
- How to add button to top of theme customizer?
- Predefine Magazine Style Layouts
- Too many if’s and else if’s ?? – Must be better way [closed]
- Losing Session ID and sessionStorage when navigating to other domains on Multisite
- Grabbing value of input field inside of array
- Variable ++ in query loop
- How can I change the location where the custom field is displayed in the Quick Edit tab in WordPress