Buttons to open link in new tab?
-
Hi! We are using the Virtue theme on wordpress and also the plugin Virtue ToolKit (which is amazing), but can’t figure out how to make the buttons open the link in new tab. Could you please provide a tip?
Thanks in advance!
-
You can try another plugin for that:
https://www.ads-software.com/plugins/open-in-new-window-plugin/
just add target=”_blank” in href of your button ??
Hi guys! Thanks for the input, but none of this works… I already tried it and it doesn’t change anything.
Here’s how a sample button looks like :[btn text="SAMPLE BUTTON" tcolor=#FFF ?link="https://www.google.com"]
Here’s the php code of the button from the editor:
function kad_button_shortcode_function( $atts) { extract(shortcode_atts(array( 'bcolor' => '', 'link' => '', 'text' => '', 'tcolor' => '', ), $atts)); return '<a href="'.$link.'" class="kad-btn kad-btn-primary" style="background-color:'.$bcolor.'; color:'.$tcolor.'">'.$text.'</a>'; } function kad_blockquote_shortcode_function( $atts, $content) { extract(shortcode_atts(array( 'align' => 'center', ), $atts)); switch ($align) { case "center": $output = '<div class="blockquote-full postclass clearfix">' . do_shortcode($content) . '</div>'; break; case "left": $output = '<div class="blockquote-left postclass clearfix">' . do_shortcode($content) . '</div>'; break; case "right": $output = '<div class="blockquote-right postclass clearfix">' . do_shortcode($content) . '</div>'; break; } return $output; } function kad_pullquote_shortcode_function( $atts, $content) { extract( shortcode_atts( array( 'align' => 'center' ), $atts )); switch ($align) { case "center": $output = '<div class="pullquote-center">' . do_shortcode($content) . '</div>'; break; case "right": $output = '<div class="pullquote-right">' . do_shortcode($content) . '</div>'; break; case "left": $output = '<div class="pullquote-left">' . do_shortcode($content) . '</div>'; break; } return $output; } function kad_hrule_function( ) { return '<div class="hrule clearfix"></div>'; } function kad_hrpadding10_function( ) { return '<div class="space_20 clearfix"></div>'; } function kad_hrpadding20_function( ) { return '<div class="space_40 clearfix"></div>'; } function kad_hrpadding40_function( ) { return '<div class="space_80 clearfix"></div>'; } function kad_clearfix_function( ) { return '<div class="clearfix"></div>'; } function kad_columnhelper_function( ) { return ''; } function virtuetoolkit_register_shortcodes(){ add_shortcode('accordion', 'kad_accordion_shortcode_function'); add_shortcode('pane', 'kad_accordion_pane_function'); add_shortcode('tabs', 'kad_tab_shortcode_function'); add_shortcode('tab', 'kad_tab_pane_function'); add_shortcode('columns', 'kad_column_shortcode_function'); add_shortcode('hcolumns', 'kad_hcolumn_shortcode_function'); add_shortcode('span11', 'kad_column11_function'); add_shortcode('span10', 'kad_column10_function'); add_shortcode('span9', 'kad_column9_function'); add_shortcode('span8', 'kad_column8_function'); add_shortcode('span7', 'kad_column7_function'); add_shortcode('span6', 'kad_column6_function'); add_shortcode('span5', 'kad_column5_function'); add_shortcode('span4', 'kad_column4_function'); add_shortcode('span3', 'kad_column3_function'); add_shortcode('span2', 'kad_column2_function'); add_shortcode('span1', 'kad_column1_function'); add_shortcode('columnhelper', 'kad_columnhelper_function'); add_shortcode('icon', 'kad_icon_shortcode_function'); add_shortcode('video', 'kad_video_shortcode_function'); add_shortcode('pullquote', 'kad_pullquote_shortcode_function'); add_shortcode('blockquote', 'kad_blockquote_shortcode_function'); add_shortcode('btn', 'kad_button_shortcode_function'); add_shortcode('hr', 'kad_hrule_function'); add_shortcode('space_20', 'kad_hrpadding10_function'); add_shortcode('space_40', 'kad_hrpadding20_function'); add_shortcode('space_80', 'kad_hrpadding40_function'); add_shortcode('kad_youtube', 'kad_youtube_shortcode_function'); add_shortcode('kad_vimeo', 'kad_vimeo_shortcode_function'); add_shortcode('clear', 'kad_clearfix_function'); } add_action( 'init', 'virtuetoolkit_register_shortcodes'); function virtue_register_button( $buttons ) { array_push( $buttons, "|", "kadcolumns" ); array_push( $buttons, "|", "kaddivider" ); array_push( $buttons, "|", "kadaccordion" ); array_push( $buttons, "|", "kadquote" ); array_push( $buttons, "|", "kadbtn" ); array_push( $buttons, "|", "kadicon" ); array_push( $buttons, "|", "kadyoutube" ); array_push( $buttons, "|", "kadvimeo" ); return $buttons; } function virtue_add_plugin( $plugin_array ) { $plugin_array['kadcolumns'] = VIRTUE_TOOLKIT_URL . '/shortcodes/columns/columns_shortgen.js'; $plugin_array['kadicon'] = VIRTUE_TOOLKIT_URL . '/shortcodes/icons/icon_shortgen.js'; $plugin_array['kadaccordion'] = VIRTUE_TOOLKIT_URL . '/shortcodes/accordion/accordion_shortgen.js'; $plugin_array['kadvideo'] = VIRTUE_TOOLKIT_URL . '/shortcodes/video/video_shortgen.js'; $plugin_array['kadyoutube'] = VIRTUE_TOOLKIT_URL . '/shortcodes/youtube/youtube_shortgen.js'; $plugin_array['kadvimeo'] = VIRTUE_TOOLKIT_URL . '/shortcodes/vimeo/vimeo_shortgen.js'; $plugin_array['kadquote'] = VIRTUE_TOOLKIT_URL . '/shortcodes/pullquote/quote_shortgen.js'; $plugin_array['kadbtn'] = VIRTUE_TOOLKIT_URL . '/shortcodes/btns/btns_shortgen.js'; $plugin_array['kaddivider'] = VIRTUE_TOOLKIT_URL . '/shortcodes/divider/divider_shortgen.js'; return $plugin_array; } function virtue_tinymce_shortcode_button() { if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') ) { return; } if ( get_user_option('rich_editing') == 'true' ) { add_filter( 'mce_external_plugins', 'virtue_add_plugin' ); add_filter( 'mce_buttons_3', 'virtue_register_button' ); } } add_action('init', 'virtue_tinymce_shortcode_button');
We are working on an update to add this to the shortcode for the virtue tool-kit widget. Should be live tomorrow. Sorry for the delay.
Kadence Themes
- The topic ‘Buttons to open link in new tab?’ is closed to new replies.