Documentation › Hook Reference

Hook Reference

Hooks are placeholders in a framework that allow developers to add custom functions. By using hooks, you insert code, or sometimes modify existing code, without changing the core files (changing core files is generally bad, unless you know what you are doing and are willing to deal with the problems you may inadvertently cause). Headway makes use of WordPress hooks. Headway itself has hooks at strategic spots, such as after the post content, before the header, and at the end of the navigation. If you’re new to hooks and need an introduction, see these articles before diving in:

To give you some ideas of how you can use hooks:

  • Using the after_post_content hook, you might insert some Google Adsense code. Then you could have an ad after all of your posts.
  • With the same hook, you might add an “about the author” box after each post.
  • You could use the before_header_hook to put a banner ad or some social media icons at the top of every webpage on your site.

Action Hooks

General Hooks

Note: If you want to use one of the hooks that can take a unique block ID or block type, replace #BLOCK_ID# or #BLOCK_TYPE# with a valid block ID or block type.

  • headway_after_block
  • headway_after_block_#BLOCK_ID#
  • headway_after_entry
  • headway_after_entry_comments
  • headway_after_entry_content
  • headway_after_entry_title
  • headway_after_footer
  • headway_after_header_link
  • headway_after_tagline
  • headway_after_wrapper
  • headway_before_block
  • headway_before_block_#BLOCK_ID#
  • headway_before_entry
  • headway_before_entry_comments
  • headway_before_entry_content
  • headway_before_entry_title
  • headway_before_footer
  • headway_before_header_link
  • headway_before_wrapper
  • headway_block_close
  • headway_block_close_#BLOCK_ID#
  • headway_block_content_#BLOCK_TYPE#
  • headway_block_content_close
  • headway_block_content_close_#BLOCK_ID#
  • headway_block_content_open
  • headway_block_content_open_#BLOCK_ID#
  • headway_block_open
  • headway_block_open_#BLOCK_ID#
  • headway_body_close
  • headway_body_open
  • headway_entry_close
  • headway_entry_open
  • headway_footer_close
  • headway_footer_open
  • headway_head_extras (for things like feed links or meta viewport)
  • headway_html_close
  • headway_html_open
  • headway_page_start
  • headway_register_elements (the action at which all elements are registered—use if not registering elements using the block API)
  • headway_scripts (for JavaScript needing to go in the <head> tags)
  • headway_seo_meta (for SEO metadata)
  • headway_setup (the top-level action, similar to WordPress’ init; runs after Headway has loaded all of its files)
  • headway_setup_child_theme (best place to run hooks for a child theme)
  • headway_stylesheets (for CSS code needing to go in the <head> tags)
  • headway_whitewrap_close
  • headway_whitewrap_open
  • headway_wrapper_close
  • headway_wrapper_open

Block Specific Hooks


  • headway_before_pin_thumbnail
  • headway_after_pin_thumbnail
  • headway_before_pin_meta
  • headway_after_pin_meta
  • headway_before_pin_content
  • headway_after_pin_content
  • headway_before_pin_board_pagination
  • headway_after_pin_board_pagination

Filter Hooks


  • body_class
  • headway_admin_link
  • headway_archive_title
  • headway_category_archive_meta
  • headway_category_title
  • headway_child_theme_id
  • headway_comments_closed
  • headway_copyright
  • headway_doctype
  • headway_go_to_top_link
  • headway_gzip
  • headway_link
  • headway_meta
  • headway_no_comments
  • headway_post_type_archive_title
  • headway_query_title
  • headway_search_title
  • headway_tag_archive_meta
  • headway_tag_title
  • headway_taxonomy_archive_title
  • post_class

Block Specific Hooks

Content Block

  • headway_content_block_custom_query [See example below]


This action hook is inserting a logo (using the WordPress add_action function):

function insert_fancy_logo() { ?> 
<img src="" /> 	
<?php } 
?> <?code>

This “comments closed” filter hook is preventing comments on a post (using the WordPress add_filter function) and adding custom text:

function change_closed_comments() { 	
return 'No Comments for You!'; 	} 	

This hook inserts HTML (in this case, links) into the opening of the footer block.

function insert_links_footer() { 	
?> 	<!-- HTML goes next --> 		
<a href="#">Link 1</a> <br /> 		
<a href="#">Link 2</a> 	
<!-- End HTML --> 	
<?php 	} 	
add_action('headway_footer_open', 'insert_links_footer'); 		//Tells WordPress to run the insert_link_footer() function when Headway's headway_footer_open hook is called. 	


add_filter('headway_content_block_custom_query', 'content_custom_query_example', 10, 2);
function content_custom_query_example($query, $block) {
if ( $block['id'] != 'exampleblockid' ) {
return $query;
$query['author'] = 123;
return $query;

Copyright © 2016 Vesped Inc. All Rights Reserved. Proudly Powered by Headway and WordPress