WordPress.org

Forums

Fruitful
[resolved] Title link/Title picture (5 posts)

  1. KFilip
    Member
    Posted 1 year ago #

    I tried to add a link on the info box title but it only changes the title text to "SOME TITLE". Also i can't add a picture above the title, and I can see that the theme can have that.

    Thanks in advance.

  2. Fruitful Code
    Member
    Theme Author

    Posted 1 year ago #

    Add link to infobox block

    <a href="http://wordpress.org">[info_box]Content for second column [/info_box]</a>

    Information about shortcodes
    http://themes.fruitfulcode.com/fruitful/shortcodes/

    To replace placeholder images use attribute icon_url="http://yoursite/wp-uploads/image.png"

  3. ozcampbell
    Member
    Posted 1 year ago #

    I have tried the following code to add a link to the info_box but it does not work. Your theme is a very nice theme but if I can't add links to the info_box images then the theme is worthless to me. Please help.

    [info_box]Content for second column [/info_box]

  4. Fruitful Code
    Member
    Theme Author

    Posted 1 year ago #

    It's not possible add link only on image. Wait new theme version release with new shortcodes.

  5. ozcampbell
    Member
    Posted 1 year ago #

    I solved it!

    Please complete the following steps:

    STEP 1. Change code in functions.php

    Find the function "fruitful_add_info_box" and replace the code with this:

    /*Add information box into content block*/
    function fruitful_add_info_box ($atts, $content = null) {
    	global $columns_count;
    	$out = $columns_class = "";
    	shortcode_atts(array(
    		  'id'			=> '',
    		  'link_it'		=> '',
    		  'icon_url' 		=> '',
    		  'title'	 	=> '',
    		  'type_column' 	=> '',
    		  'alt'			=> '',
    		  'style_text'	  	=> '',
    		  'style_title'		=> ''
         ), $atts, 'info_box');
    
    	 $id = 'info_box_0';
    	 $link_it = '';
    	 $icon_url  = get_template_directory_uri()  . '/images/default_icon.png';
    	 $title	= 'Some title';
    	 $type_column = '';
    	 $alt 	  = '';
    	 $style_text  = 'text-align:center; font-size:13px; ';
    	 $style_title = 'text-align:center; font-size: 20px; text-transform: uppercase; ';
    
    	 if (isset($atts['id']))		{ $id = sanitize_html_class($atts['id']); }
    	 if (isset($atts['type_column'])) 	{ $type_column  = esc_attr($atts['type_column']); }
    	 if (isset($atts['link_it']))	 	{ $link_it	 	= $atts['link_it']; }
    	 if (isset($atts['icon_url'])) 		{ $icon_url 	= $atts['icon_url']; }
    	 if (isset($atts['title'])) 		{ $title 		= esc_attr($atts['title']); }
    	 if (isset($atts['alt'])) 		{ $alt 			= esc_attr($atts['alt']); }
    	 if (isset($atts['style_text'])) 	{ $style_text  	= esc_html($atts['style_text']); }
    	 if (isset($atts['style_title'])) 	{ $style_title 	= esc_html($atts['style_title']); }
    
    	 if ($columns_count != '') {
    		 if ($columns_count == 1) { $columns_class	= 'sixteen columns'; }
    		 else if ($columns_count == 2)	{ $columns_class	= 'eight columns';}
    		 else if ($columns_count == 3)	{ $columns_class	= 'one-third column'; }
    		 else if ($columns_count == 4)	{ $columns_class	= 'four columns'; }
    	 }
    
    	 $out .= '<div class="'.$columns_class.' info_box '. $type_column .'" id="' . $id . '">';
    		$out .= '<a href="' . esc_url($link_it) .'"><img class="icon" src="'. esc_url($icon_url) .'" title="' . $title . '" alt="'.$alt.'"/></a>';
    		$out .= '<a href="' . esc_url($link_it) . '"><div class="infobox_title" style="text-decoration:none;' . $style_title .'">'  . $title . '</div></a>';
    		$out .= '<div class="info_box_text" style="' . $style_text .'" >'  . $content . '</div>';
    	 $out .= '</div>';
    return $out;
    }

    STEP 2. Save your change.

    STEP 3. Edit the home page with the info_box_area and add the link_it shortcode:

    [info_box link_it="(Your Page Link)" icon_url="(Your Icon Link)" alt="(Your Alt Name)" id="inb_1" type_column="omega" title="(Your Title)"]Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam quis cursus tortor. Cras feugiat urna at dui sollicitudin, ut lobortis libero auctor.[/info_box]

    [info_box link_it="(Your Page Link)" icon_url="(Your Icon Link)" alt="(Your Alt Name)" id="inb_2" type_column="omega" title="(Your Title)"]Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam quis cursus tortor. Cras feugiat urna at dui sollicitudin, ut lobortis libero auctor.[/info_box]

    [info_box link_it="(Your Page Link)" icon_url="(Your Icon Link)" alt="(Your Alt Name)" id="inb_3" type_column="omega" title="(Your Title)"]Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam quis cursus tortor. Cras feugiat urna at dui sollicitudin, ut lobortis libero auctor.[/info_box]

    The icons and the title text will now link to your required URLs.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic

Tags

No tags yet.