Digital experiences for all disciplines
New Landing › How can we help? › Themeforest Theme Support › Flexform › Text Block Widget TItle as Link
New Landing › How can we help? › Themeforest Theme Support › Flexform › Text Block Widget TItle as Link
- This topic has 11 replies, 3 voices, and was last updated 11 years by laranz – SUPPORT.
-
Posted in: Flexform
-
October 11, 2013 at 2:07 pm #26359
It would be much more intuitive if the widget title had the option to act as a the link to whatever content we are getting users to go to.
How would I go about doing this?
October 13, 2013 at 8:54 pm #26499Hi,
Did you try this plugin? http://wordpress.org/plugins/widget-title-links/
Let me know, what you got.
Thanks,
laranz.October 14, 2013 at 8:25 pm #26654I am not sure how I would get this to get change your wpb_heading into a link though.
The titles beside the icons within the 4 sections on this page. http://working.inkochostudios.com/ait4you/October 16, 2013 at 8:38 pm #26990Hi,
Oh sorry you mean the swift page builder’s text widget and its title? I thought you are asking for the default Widget title in Appearance -> Widgets. Apologies for the confusions. That is not possible at the moment by default.
Thanks,
laranz.October 24, 2013 at 3:54 pm #28214Where would I need to look within the code to make that a reality?
October 24, 2013 at 6:18 pm #28246Hi all!
I’ve been following this thread as I needed to link the text block title.
When support came back and said ‘not possible’ I decided I’d better code it myself!
Disclaimer: this is a complete and utter blatant hack of the original code which will be lost on updating the theme. There will be a much prettier and foolproof way to do this but at this point I needed a quick hack that does the job which I can come back to later to complete. It assumes that you want to link every box title rather than checking if the attribute is set before inserting the link – easily adjusted but don’t have the time at the moment!
So in ‘/wp-content/themes/flexform/includes/page-builder/composer/lib/shortcodes/default.php’ I replaced the following code (line 62-115):
class WPBakeryShortCode_box extends WPBakeryShortCode { public function content( $atts, $content = null ) { $title = $type = $custom_styling = $custom_bg_colour = $custom_text_colour = $pb_margin_bottom = $el_class = $width = $el_position = ''; extract(shortcode_atts(array( 'title' => '', 'type' => '', 'custom_bg_colour' => '', 'custom_text_colour' => '', 'pb_margin_bottom' => 'no', 'el_class' => '', 'el_position' => '', 'width' => '1/2' ), $atts)); $output = ''; $el_class = $this->getExtraClass($el_class); $width = wpb_translateColumnWidthToSpan($width); $el_class .= ' wpb_box_text'; $el_class .= ' '.$type; if ($pb_margin_bottom == "yes") { $el_class .= ' pb-margin-bottom'; } if ($custom_bg_colour != "") { $custom_styling .= 'background: '.$custom_bg_colour.'!important;'; } if ($custom_text_colour != "") { $custom_styling .= 'color: '.$custom_text_colour.'!important;'; } $output .= "\n\t".'<div class="wpb_content_element '.$width.$el_class.'">'; $output .= "\n\t\t".'<div class="wpb_wrapper">'; $output .= ($title != '' ) ? "\n\t\t\t".'<div class="heading-wrap"><h3 class="wpb_heading wpb_text_heading"><span>'.$title.'</span></h3></div>' : ''; $output .= "\n\t\t\t"; if ($custom_styling != "") { $output .= '<div class="box-content-wrap" style="'.$custom_styling.'">'.do_shortcode($content).'</div>'; } else { $output .= '<div class="box-content-wrap">'.do_shortcode($content).'</div>'; } $output .= "\n\t\t".'</div> ' . $this->endBlockComment('.wpb_wrapper'); $output .= "\n\t".'</div> ' . $this->endBlockComment($width); // $output = $this->startRow($el_position) . $output . $this->endRow($el_position); return $output; } }'
with:
class WPBakeryShortCode_box extends WPBakeryShortCode { public function content( $atts, $content = null ) { $title = $type = $custom_styling = $custom_bg_colour = $custom_text_colour = $pb_margin_bottom = $el_class = $width = $el_position = ''; extract(shortcode_atts(array( 'title' => '', 'type' => '', 'link' => '', 'target' => '', 'custom_bg_colour' => '', 'custom_text_colour' => '', 'pb_margin_bottom' => 'no', 'el_class' => '', 'el_position' => '', 'width' => '1/2' ), $atts)); $output = ''; $el_class = $this->getExtraClass($el_class); $width = wpb_translateColumnWidthToSpan($width); $el_class .= ' wpb_box_text'; $el_class .= ' '.$type; if ($pb_margin_bottom == "yes") { $el_class .= ' pb-margin-bottom'; } if ($custom_bg_colour != "") { $custom_styling .= 'background: '.$custom_bg_colour.'!important;'; } if ($custom_text_colour != "") { $custom_styling .= 'color: '.$custom_text_colour.'!important;'; } $output .= "\n\t".'<div class="wpb_content_element '.$width.$el_class.'">'; $output .= "\n\t\t".'<div class="wpb_wrapper">'; $output .= ($title != '' ) ? "\n\t\t\t".'<div class="heading-wrap"><h3 class="wpb_heading wpb_text_heading"><span><a href="'.$link.'" target="'.$target.'">'.$title.'</a></span></h3></div>' : ''; $output .= "\n\t\t\t"; if ($custom_styling != "") { $output .= '<div class="box-content-wrap" style="'.$custom_styling.'">'.do_shortcode($content).'</div>'; } else { $output .= '<div class="box-content-wrap">'.do_shortcode($content).'</div>'; } $output .= "\n\t\t".'</div> ' . $this->endBlockComment('.wpb_wrapper'); $output .= "\n\t".'</div> ' . $this->endBlockComment($width); // $output = $this->startRow($el_position) . $output . $this->endRow($el_position); return $output; } }
You can then use the attribute ‘link=”www.google.com”‘ in the [box] shortcode:
[box title="Title" type="Type" pb_margin_bottom="no" el_class="Class" width="1/1" link="http://www.google.com"]Content[/box]
Hope this helps you out!
October 24, 2013 at 7:03 pm #28273Thanks Highland, I will have a look at this later on this evening.
Cheers!October 25, 2013 at 8:42 pm #28571Thanks for the heads-up. ๐
I said it is not possible by *default*, with custom code everything is possible ๐
Thanks,
laranz.October 26, 2013 at 9:27 am #28626Hi @Laranz
Indeed everything is possible with custom code. It’s disappointing that a 5-star support response to this query, which Swift Ideas advertise when selling their themes, was “that is not possible at the moment by default”.
Perhaps a 6-star support response would be “Sorry, that is not possible at the moment by default. Try looking in โ/wp-content/themes/flexform/includes/page-builder/composer/lib/shortcodes/default.phpโ for the code behind the [box] shortcode.”?
October 28, 2013 at 5:23 am #28760Hi,
Sorry, for the inconvenience.
Why we don’t reply like that means, most of them are not coding people, if we tell like maybe they screw the coding and the web page didn’t work.. If you ask how to do after my reply, we are happy to help you. I don’t know you code or not.. Hope you understand.
Thanks,
laranz.October 28, 2013 at 8:11 am #28775Hi Laranz,
Thanks for the ‘heads-up’.
How do you know most of your customers are not coding people? Is this just an assumption that strings out questions like this from being sorted within 24-48 hours to nearly 2 weeks? Do you see what I’m highlighting? You could cover all bases by pointing the customer in the correct direction in the first reply as well as abandoning them with an ‘it’s not possible by default’.
Thanks
October 28, 2013 at 9:30 am #28790Hi,
Sorry the inconvenience caused.
After you asking this question “Where would I need to look within the code to make that a reality?” someone in the forum answer you, If he didn’t surely I will help you the same way or at least point you in the correct direction. Sorry if you misunderstand my answers. Anything other than the theme defaults are taken as customization, we won’t cover those, but if it small like these we sure help you the way as quick as possible. Hope you understand.
Thanks,
laranz. -
Posted in: Flexform
You must be logged in and have valid license to reply to this topic.