Bootstrap 3.0 Carousel gallery post WordPress
IMO, clean wp code is hard, if not impossible to acchieve. I can tell you, however, that the first thing I'd remove from your functions is the echo $html; statements.

A function is a block of code that does something, and returns that data, to be used anywhere. Your functions don't return anything (apart from the implicit null), but echo a heck of a lot. That could be considered a side-effect. Functions that have side-effects are bad news. Why not replace the echo $html; with a simple return $html; for a start, then call the functions like so:

&lt;?=function_slides();?&gt;


&lt;?= is short for &lt;?php echo, and doesn't require the short_tags to be enabled anyway.
This is only the tip of the ice-berg, though. Your functions contain an awful lot of duplicate statements ($special_gallery = get_post_gallery( $post, false ), for one). Why not pass that as an argument, so you can keep it in scope for all calls, and avoid the overhead of repeating the same function calls?
What's more: the entire function bodies of both function_slides and function_indicators are remarkably similar, and could easily be combined into a single function:

function functions_slide_indicator($post) //specify argument, you forgot this
{
    $special_gallery = get_post_gallery( $post, false );
    $ids = explode( ",", $special_gallery['ids'] );
    $formats = array(
        'indicator' =&gt; '&lt;li data-target="#carousel-example-generic" data-slide-to="%d"&gt;&lt;/li&gt;',
        'slide'     =&gt; '&lt;div class="item"&gt;&lt;img src="%s"&gt;&lt;div class="carousel-caption"&gt;&lt;h4&gt;%s&lt;/h4&gt;&lt;p&gt;%s&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;'
    );
    $html = array(
        'indicator' =&gt; '&lt;ol class="carousel-indicators"&gt;&lt;li data-target="#carousel-example-generic" data-slide-to="0" class="active"&gt;&lt;/li&gt;',
        'slide'     =&gt; '&lt;div class="carousel-inner"&gt;'
    );
    $link= wp_get_attachment_url($ids[0]);//get data for first id, not in loop
    $attachment_meta = wp_get_attachment($ids[0]);
    $html['slide'] .= sprintf(str_replace('&lt;div class="item"', '&lt;div class="active item"', $formats['slide']), $link, $attachment_meta['title'], $attachment_meta['description']);
    for($i = 1, $j = count($ids);$i&lt;$j;$i++)
    {//start at 1, not 0, so no active class in here
        $link   = wp_get_attachment_url( $ids[$i] );
        $attachment_meta = wp_get_attachment($ids[$i]);
        $html['indicator'] .= sprintf($formats['indicator'], $i);// no need to increment/decrement it here, it'll be the value you need
        $html['slide'] .= sprintf($formats['slide'],$link, $attachment_meta['title'], $attachment_meta['description']);
    }
    $html['indicator'] .= '&lt;/ol&gt;';
    $html['slide'] .= '&lt;/div&gt;';//close markup
    return $html;//return array
}


Call this like so:

&lt;?php
    $content = functions_slide_indicator($post);
    echo $content['indicator'];//indicators
    echo $content['slide'];//carousel


Of course, this is only the start, instead of calling that function in the loop, I'd personally go for:

$links = array_map($ids, 'wp_get_attachment_url');


For example. Though this isn't the most performant way to go, at least it looks cleaner, though it could look cleaner still, if you used Objects.