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
- 404 error on page reload
- WP Bootstrap NavWaker: Dropdown Menu Opens All Dropdown Menus at Once
- Custom Field IF/ELSE PHP
- Noscript not working as it should in wordpress site
- WordPress Ajax Call inserting data but success response false
- How to optimize the IF condition with many conditions and same output [closed]
- How to remove woocommerce_breadcrumb() from do_action( ‘woocommerce_before_main_content’ ); [closed]
- ‘Post-thumbnails’ feature does not seem to register
- if statement with is_active_sidebar()
- Which PHP page is the Default Posts Page
- How to convert select to HTML with PHP tags inside of it [closed]
- Sanitizing text fields in array
- WordPress admin-ajax.php
- Use .php file as page instead of wordpress page & template file?
- How to combine 2 php functions into one function with a custom field
- Remove the last X characters of a custom field value
- Advanced Custom Fields – display label and value only if value entered
- Use WordPress function in php file
- How to correctly add Javascript to this PHP ‘Page Not Found’ Page?
- Is it possible to retrieve all posts with a certain value for metadata?
- Where WordPress Stores The Custom Fields Values
- What does this mean in wordpress? Easy question
- How to obtain the current website URL in my theme?
- 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?
- Admin ToolBar not being displayed at top of site
- Is the wp_enqueue method efficient?
- Royalty-Free Sliders used in theme development
- PHP echo inside javascript
- Non-Closing PHP Query in WordPress Loop
- Why am I getting a different filename? And how does WordPress load singular.php for both Page & Post? (Fresh WordPress installation)
- Show meta box only for default page template
- Illegal string offset in PHP function
- admin-ajax Firing Error 400 When Logged In
- How to add API security keys into JS of wordpress securely
- Error – ‘create_function is deprecated’ [closed]
- How to set up a If is_singular statement?
- get taxonomy thumbnail and use it as a variable in code
- What are the advantages/disadvantages of using jQuery DOM manipulation as opposed to PHP DOM manipulation?
- Add Codepen animation as Preloader to WordPress
- Reason to add a name of the theme like (‘menu-1’ => __( ‘Primary’, ‘twentynineteen’ ),) in PHP?
- Underscore – Self hosted fonts
- Separation of presentation and code – WordPress
- element not working in Safari [closed]
- Why are the details of my todo not saving?
- Tell WP register script to load a script only when the entire page is loaded
- Making an AJAX call to refresh a table
- How to check if a PHP string is different than meta field?
- Can’t save php string to a custom field
- HTML escaping data with ajax requests
- Search form does not work in my website
- Show About and Contact Us page when they’re clicked in the top menu.
- Display custom field on 404 page outside loop
- Is There A Way To Make Theme Files Accept Shortcodes?
- get_template_part() not firing within a switch statement when template has new WP_Query
- add onchange to select in a wp form
- WordPress Customizer Default Image
- How to show/hide php table rows based on the content of custom fields
- Run str_replace on title and save the output to a custom field
- How to call multiple functions from multiple files into a WordPress page template [closed]
- Theme’s Options Page included with require_once *.php in functions.php not visible anymore