• Hi,

    I am looking for a way to get the current index of the item displayed in the custom parts/wp-instagram-widget.php.

    I need this index, because the HTMl will change depending the current item number (custom grid…)

    Ideally I would need something like:

    $index = 0;
    foreach( $media_array as $item ) {
      if ( locate_template( $template_part ) !== '' ) {
        include locate_template( $template_part );
      } else {
        echo blabla
      }
    $index++;
    }

    or maybe even simpe with

    foreach( $media_array as $key => $item ) {
      if ( locate_template( $template_part ) !== '' ) {
        include locate_template( $template_part );
      } else {
        echo blabla
      }
    }
    • This topic was modified 6 years, 7 months ago by anakaotheme.
    • This topic was modified 6 years, 7 months ago by anakaotheme.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘In the custom part, get in the index of the current item’ is closed to new replies.