Adding An Action

Hopefully by now you understand what action hooks are and how they work. However, if you are still a bit confused hopefully an example will help!

Add Extra Text Under Your Header
A good example of using an action hook may be adding extra text under your header. This could be useful for adding a banner to your site, advertisement in the header, maybe an alternative logo (to display on mobile devices – by using CSS to show/hide each one accordingly), adding a quote…etc.

The Code: The following code would add the text “Some Text, could be anything though” to your header.

// This is your function, you can name it anything you want
function my_custom_header_text() { ?>

Some Text, could be anything though

// Total version 3.5.3+ required!!
add_action( ‘wpex_hook_site_logo_inner’, ‘my_custom_header_text’, 999 );
Notice the ‘999’ part in the add_action function, this is the “priority” so that will make sure your function runs after other functions attached to the same hook. The default priority is 10 , I added 999 as an example but most likely you can set the priority at 10 or 20.