Change posts and views into fa-icons

  • We use the dutch language and the words posts and views are very long in our language (Onderwerpen and Berichten) because of this the text is overlapping.

    Is it possible to use font awesome icons instead of text?
    And if it's possible how can I change it?

  • bump ^^

  • bump 2

    can sombody help me please?

  • GNU/Linux Admin

    Sure, this looks like an issue with widget-essentials...

    I don't know if there's a way to detect when text overruns their containers, and I'm assuming you don't want the word truncated with ellipses.

    I'd just use client-side javascript, and replace those words on the fly...

    $(window).on('action:widgets.loaded', function () {
      // do something here...

  • @julian said in Change posts and views into fa-icons:

    $(window).on('action:widgets.loaded', function () {
    // do something here...

    must I do this in CSS ?

  • Community Rep

    @MJ CSS? Nah. Just execute some JS
    For example:

    $(window).on('action:widgets.loaded', function () {
    	.find('.stats > small')
    	.each(function (i, el) {
    			$small = $(el),
    			text = $small.text(),
    		if (text === 'Topics')
    			iconClass = 'fa-group'
    		else if (text === 'Posts')
    			iconClass = 'fa-group'
    		else if (text === 'Views')
    			iconClass = 'fa-group'
    		$icon = $('<i class="fa fa-fw ' + iconClass + '"></i>')

    P.S. Actually, the best way to change something in a theme - is to fork the theme and make whatever changes you want in your own repository. But you'll have to keep track of any new changes from the original theme repository, resolve merge conflicts, etc. This way is a hard way. The example I've provided above is the easy one.

  • @Mega where do I put the code?

  • @Mega how do I use the code and where must I put it?

  • GNU/Linux Admin

    You can do this in the custom HTML section... wrap it in <script></script>

    An HTML widget might also work.

Suggested Topics

| | | |