Digital experiences for all disciplines
New Landing › How can we help? › Themeforest Theme Support › Dante › Alt and Title tags – within button shortcodes?
New Landing › How can we help? › Themeforest Theme Support › Dante › Alt and Title tags – within button shortcodes?
- This topic has 16 replies, 3 voices, and was last updated 9 years by Kyle – SUPPORT.
-
Posted in: Dante
-
May 19, 2015 at 9:02 am #176334
Hi there,
I would really like to have alt and title tags within button shortcodes as u can with regular text links. When Adding them manually within the button shortcode they get stripped in the browser? (I have checked in Firebug).Do you have a hack / method for allowing these web standard tags?
Cheers
May 19, 2015 at 9:42 am #176356Hi
I’m afraid there isn’t currently a parameter in the button shortcode for alt tags and title tags. Something I will add to the list however not had anyone ask for this before
– Kyle
May 19, 2015 at 9:51 am #176362ok,
alt and title tags are a very old web standard. Others may not have asked because they may not appreciate the value of these tags?No temporary work around until this is added into the framework?
Cheers
May 19, 2015 at 9:51 am #176363Hi,
Please provide me specific page url with strip button. I will give to you custom css code to resolve the issue.Thanks
MohammadMay 19, 2015 at 9:57 am #176366Hi,
I’m developing locally. Its just a standard button shortcode:[sf_button colour="accent" type="standard" size="large" link="#" target="_self" icon="" dropshadow="no" extraclass="" title="A custom title tag that gets stripped"]Large button[/sf_button]
Cheers
May 19, 2015 at 10:02 am #176367Hi,
Please attach screenshot of your issue.
Thanks
MohammadMay 19, 2015 at 10:12 am #176370Hi,
no screenshot required here? Do you know what a title tag (attribute) is? – http://www.w3.org/TR/WCAG20-TECHS/H33.htmlIn the shortcode (I posted above) the – title=”A custom title tag that gets stripped” is the part that gets removed in the browser IE: I manually added this attribute to the shortcode, its NOT there by default. I don’t think you can aleviate this issue with css?
May 19, 2015 at 10:21 am #176377Hi
Yes it gets stripped because there is no such parameter ‘title’ for the shortcode. The only workaround would be to use html for the button instead of the shortcode, for e.g:
<a class="sf-button standard accent" href="#" target="_self"><span class="text">TAKE THE TOUR TO FIND OUT MORE</span></a>
– Kyle
May 19, 2015 at 10:27 am #176383Hi,
Please open to edit shortcodes.php file at /dante/swift-framework/.1- Find this code:- $button_output .= '<a class="'.$button_class.'" href="'.$link.'" target="'.$target.'">'; Change with:- $button_output .= '<a class="'.$button_class.'" href="'.$link.'" target="'.$target.'" title="'.$title.'">'; 2- Find this code:- "extraclass" => '' Change with:- "extraclass" => '', "title"=>''
Thanks
MohammadMay 19, 2015 at 10:29 am #176384Thanks ๐
Will add a filter in my functions.php to apply to the framework.
Appreciate your help.
Cheers
May 19, 2015 at 10:30 am #176386No problem, thanks Mohammad
– Kyle
May 19, 2015 at 11:35 am #176424Hi there,
your temporary hack works fine ๐ but I have been trying to do this from my functions.php but doesn’t seem to work? Can you take a quick look at this and tell me if you see any obvious issue (am I missing something here?):add_action( 'after_setup_theme', 'my_dante_shortcode' ); function my_dante_shortcode() { if (!function_exists('sf-button')) { remove_shortcode( 'sf-button' ); } add_shortcode( 'sf-button', 'my-button' ); } function my_button($atts, $content = null) { extract(shortcode_atts(array( "size" => "standard", "colour" => "", "type" => "", "link" => "#", "target" => '_self', "dropshadow" => '', "icon" => '', "extraclass" => '', "title" => '' ), $atts)); $button_output = ""; $button_class = 'my-button '.$size.' '. $colour .' '. $type .' '. $extraclass; if ($dropshadow == "yes") { $button_class .= " dropshadow"; } if ($type == "sf-icon-reveal" || $type == "sf-icon-stroke") { $button_output .= '<a class="'.$button_class.'" href="'.$link.'" target="'.$target.'" title="'.$title.'">'; $button_output .= '<i class="'.$icon.'"></i>'; $button_output .= '<span class="text">'. do_shortcode($content) .'</span>'; $button_output .= '</a>'; } else { $button_output .= '<a class="'.$button_class.'" href="'.$link.'" target="'.$target.'" title="'.$title.'"><span class="text">' . do_shortcode($content) . '</span></a>'; } return $button_output; } add_shortcode('my_button', 'my_button');
Really don’t want to alter the main theme for future updates!
Cheers
May 19, 2015 at 12:17 pm #176445Hi
That won’t work unfortunately, as the child theme funtcions.php runs first, so the function will not exist yet for:
if (!function_exists('sf-button')) { remove_shortcode( 'sf-button' ); } add_shortcode( 'sf-button', 'my-button' ); }
to take effect, however when it runs the parent theme the function will break because it does not have the !function_exists statement
For now you will just have to make the change to the parent theme
– Kyle
May 19, 2015 at 12:54 pm #176461Ok. Is this feature likely to make it into the next minor release of the Dante theme?
Cheers
May 19, 2015 at 12:58 pm #176464I’ll pass on to the developer to consider
– Kyle
-
Posted in: Dante
You must be logged in and have valid license to reply to this topic.