Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Derek Herman

    (@valendesigns)

    This is untested code, but should do what you’re asking.

    <?php
    function testimonials_slider() {
    
      if ( function_exists( 'ot_get_option' ) ) {
    
        // Testimonials array
        $slides = ot_get_option( 'test_testimonials_list', array() );
    
        if ( ! empty( $slides ) ) {
    
          foreach( (array) $slides as $slide ) {
    
            if ( isset( $slide['image'] ) )
              echo '<img src="' . esc_url( $slide['image'] ) . '" alt="' . ( isset( $slide['title'] ) ? esc_attr( $slide['title'] ) : '' ) . '" />';
    
            if ( isset( $slide['description'] ) )
              echo '<div class="description">' . $slide['description'] . '</div>';
    
          }
    
        }
    
      }
    
    }
    add_shortcode( 'testimonials', 'testimonials_slider' );
    Thread Starter Smart Site

    (@polishyourimage)

    works like a charm – thank you so much Derek! Happy New Year and have a great weekend.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘shortcode for array?’ is closed to new replies.