Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • in reply to: Text Block Widget TItle as Link #28775
    HighlandMarketing
    Member
    Post count: 4

    Hi 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

    in reply to: Text Block Widget TItle as Link #28626
    HighlandMarketing
    Member
    Post count: 4

    Hi @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.”?

    in reply to: Text Block Widget TItle as Link #28246
    HighlandMarketing
    Member
    Post count: 4

    Hi 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!

Viewing 3 posts - 1 through 3 (of 3 total)