[Resolved] Show icon in widget title

Home Forums Support [Resolved] Show icon in widget title

Home Forums Support Show icon in widget title

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #503377
    Orlando

    Hi,

    I’m trying to show a Font Awesome icon in widget title; so far I tried enabling shortcode support for widgets, but that didn’t work – it doesn’t show anything…however, it works without GP.

    So, is there any way to acomplish this?

    TIA

    #503848
    Leo
    Staff
    Customer Support

    Hi there,

    It’s probably because we are still in the process of upgrading to FontAwesome 5.0.

    What’s the HTML you are using for the icons?

    Let me know.

    #503971
    Orlando

    Hi Leo,

    Here’s all I tried; I made a small plugin with this code:

    add_filter('widget_title', 'do_shortcode');
    
    function hcwp_add_icon_widget($attr) {
    	// Atributos
    	$attr = shortcode_atts(
    		array (
    			'id' => 'star',
    		), $attr, 'icon'  );
    		
    	return '<i class="fa fa-'.$attr['id'].'"></i>';
    }
    
    add_shortcode( 'icon', 'hcwp_add_icon_widget');

    Then I prepend the icon to the widget title with a shortcode, i.e. [icon id=star], when processed it generates “<i class=”fa fa-star”></i>” in the code…and it worked fine on a local setup without GP, but when I uploaded it didn’t show anything.

    Thanks in advance.

    #504105
    Leo
    Staff
    Customer Support

    Just making sure the load essential CSS option is not checked? https://docs.generatepress.com/article/general-settings-overview/

    #504233
    Orlando

    Hi,

    No, it’s not.

    #504630
    Tom
    Lead Developer
    Lead Developer

    Does anything show up at all? Can you link me to your site?

    #504653
    Orlando

    Hi,

    Oh dear…it’s working now. Sorry to bother you. Anyway, page is http://www.hazloconwp.com.mx.

    Thank you for your time and excellent theme!

    #504710
    Leo
    Staff
    Customer Support

    Glad you figured out!

    #797234
    John MacKenzie

    is there a way to do this without the extra function yet? i need to add a icon to a Widget Nav Title in the footer widgets?

    #797244
    Leo
    Staff
    Customer Support

    It was never a plan to add this as a feature.

    Can you open a new topic for your question?

    Depending on where you are trying to (at the start?), there might be a CSS solution.

    Thanks!

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.