October 31, 2017 at 4:37 pm
Hi Ben,
I’m trying to programmaticaly make tabs with dynamic content in a widget, however it seems complicated. I need to put other shortcodes and php inside a shortcode, is this even possible?
function booking_shortcode() {
ob_start();
echo '<div class="bookwith">';
echo (do_shortcode('[tabs]'));
//tab always showing
echo (do_shortcode('[tab][contact-form-7 id="6859" title="BRONBEZBOOK"][/tab]'));
//tab showing if not null
if ($hotelid != null) {
echo (do_shortcode('[tab title="Booking.com" start=open]'));
echo '<a target="_blank" class="bookitafter" href="*Login to see link . $bcity . '&highlighted_hotels=' . $hotelid . '">Бронировать</a>';
echo (do_shortcode('[/tab]'));
}
echo (do_shortcode('[/tabs]'));
echo '</div>';
return ob_get_clean();
}
add_shortcode('booking_sc', 'booking_shortcode');
Can i try to make it this way:
$variable = echo '<a target="_blank" class="bookitafter" href="*Login to see link . $bcity . '&highlighted_hotels=' . $hotelid . '">Бронировать</a>';
echo (do_shortcode('[tab title="Booking.com" start=open]' . $variable .'[/tab]'));