The code snippets in this tutorial enable you to add a icon before or after the entry title on any archive pages and single posts/pages.
In this case, the icons used are dashicons which are already registered in WordPress by default so you only need to load them using the following code in your functions file:
add_action( 'wp_enqueue_scripts', 'load_dashicons' );
function load_dashicons() {
wp_enqueue_style( 'dashicons' );
}
Check your child themes functions file first because your theme may already load dashicons meaning you won’t need to add the above code.
Once you’ve loaded the icons, you can then add them to your entry titles using a variety of methods.
You can either:
- Add the same icon to all entry titles or
- Add a unique icon to every entry title
The code for all solutions is included for members below:
Was This Tutorial Helpful?