• Greetings,

    I would like to add a dashicon in a post title without using any plugins. I use the Themify theme so I wonder if I can achieve this by using the Custom CSS option in the Customize menu?

    I would like the title to look something like this (* represents the dashicon):

    ” * This is an example title ”

    So only the dashicon infront of the title; no borders, margins or paddings etc. I want this icon to appear in every blog post title.

    Is there a simple line of code or some other way to achieve this?

    -TOVK

    • This topic was modified 7 years, 10 months ago by tovk.
    • This topic was modified 7 years, 10 months ago by tovk.
Viewing 1 replies (of 1 total)
  • I haven’t tried this, but I think what you’d need to do to use the dashicons on the front end without a plugin would be to either enqueue the dashicons CSS in your child theme’s functions.php, or include them (either /wp-includes/css/dashicons.css or /wp-includes/dashicons.min.css) via a link in your header.php.

    Then it would be a matter of adding the appropriate dashicons classes (you can find them here) to the .entry-title selector.

    One way to do that would be to add some jQuery to the header.php:

    
    <script type="text/javascript">
    	jQuery(document).ready(function() {
    		jQuery('.entry-title').addClass('dashicons-before dashicons-smiley');
    	});
    </script>
    

    Or you could edit the relevant theme templates to hard-code the classes to the entry titles.

Viewing 1 replies (of 1 total)
  • The topic ‘How to add a dashicon in a post title?’ is closed to new replies.