Adding a custom field to do_shortcode [closed]

There’s a general convention in WordPress:

  1. functions prefixed with the_ will echo a value
  2. functions prefixed with get_ or get_the_ will return a value

In your case you need to use get_sub_field() instead of the_sub_field() eg:

echo do_shortcode( get_sub_field( 'slideshare' ) );

The documentation on the ACF site is very comprehensive: http://www.advancedcustomfields.com/resources/functions/get_sub_field/

NOTE: In your example code you didn’t need any of the quotes, you could’ve just passed in the $slides variable directly if you were using get_sub_field()