Можно и без буфера обойтись, просто записывая всё в переменную. Ваш код:
function getShortcodeOutput() {
ob_start();
echo "some text1\n";
echo "some text2\n";
echo "some text3\n";
echo "some text4\n";
$result = ob_get_contents();
ob_end_clean();
return $result;
}
Поменяв на:
function getShortcodeOutput() {
$result = "";
$result .= "some text1\n";
$result .= "some text2\n";
$result .= "some text3\n";
$result .= "some text4\n";
return $result;
}
И получиться:
function shortcodeSliderInit($atts) {
$result = '';
extract(shortcode_atts(array(
'name' => '',
'slideshow' => 0,
'animation' => 'fade',
'controlnav' => 0,
'randomize' => 0
), $atts));
if (!$name) { return FALSE; }
$slider = ale_sliders_get_slider($name);
if (!$slider) { return FALSE; }
$slider_id = sanitize_title('ale-slider-' . $slider['slug'] . '-' . wp_generate_password(5, false));
$result .= '<div id="' . $slider_id . '" class="ale-slider-slides">';
$result .= '<div class="owl-carousel owl-theme">';
foreach ($slider['slides'] as $slide) {
if ($slide['image']) {
if ($slide['url']) {
$result .= '<a href="' . $slide['url'] . '" class="swipebox">';
}
$result .= '<img src="' . $slide['image'] . '" alt="' . $slide['title'] . '" />';
if ($slide['url']) {
$result .= '</a>';
}
}
}
$result .= '</div>';
$result .= '</div>';
return $result;
}