• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2665

Original Genesis Tutorials & 5000+ Guaranteed Code

Snippets

  • Support
  • Newsletter
  • Videos
  • Log in

Premium Member? - Request custom code

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:

Register for full access

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

PHP Code

template_include

get_body_class

if else

array

class_exists

foreach

sprintf

add_action

printf

variable

Advertise · WPEngine · Genesis · Log in

  • How Premium Membership Works
  • Sign Up
  • Support
  • Subscription Details/Invoice
  • Tagged Tutorials
  • Access-Download Problems