Add Clickable Icon Linked With Post Title

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.

icon-before-title

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:

  1. Add the same icon to all entry titles or
  2. Add a unique icon to every entry title

The code for all solutions is included for members below:

Was This Tutorial Helpful?

Free

$0

Access only to all free tutorials per month.



Monthly

$75

Access to 10 premium tutorials per month.


Tutorial Request


Includes code guarantee and coding support.

Yearly

$500

Access to 15 premium tutorials per month.


Monthly Tutorial Request


Includes code guarantee and priority coding support.