I'm having a problem with shortcodes on a website, currently you enter a shortcode in the post edit screen like the following:
[tab name=Itinerary]
This will output a tab such as:
However as you can see in the image above we get "travel" and "useful" when using the shortcodes below:
[tab name=Travel Info] or [tab name=Useful Info]
So the problem seems to be in the whitespace and the formatting. I've tried adding a "&/nbsp;" or [tab name="Travel Info"] but these solutions quickly fail. This is the function in functions.php that seems to be taking the information from the post screen:
// Tab Shortcode, creates a tab of information:
// [tab name=tab_name]
function page_tab_func( $atts ) {
$a = shortcode_atts( array(
'name' => 'Untitled'
), $atts );
$spec_chars = array("/", "@", "#", " ");
$sanitised = str_replace($spec_chars, "_", $a['name']);
// $a['name']; // Gets the tab name:
$output = "";
$output .= "</div>";
$output .= "<div id='content_{$sanitised}' class='tab-section'>";
$output .= "<h2 class='tab-name'>{$a['name']}</h2>";
return $output;
}
add_shortcode( 'tab', 'page_tab_func' );
add_filter( 'no_texturize_shortcodes', 'ignore_tag_a' );
function ignore_tag_a( $list ) {
$list[] = 'tab';
return $list;
}
I've searched Google and spent some time trying to solve this problem, if anyone has any advice in dealing with shortcode formatting or fixing this problem I'd greatly appreciate it.