DigiFusion features a comprehensive hook system that allows developers and advanced users to extend and customize the theme without modifying core theme files. This system provides more than 100 strategic insertion points throughout the theme’s template structure, enabling you to add custom content, modify layouts, and enhance functionality while maintaining theme update compatibility.
What are WordPress Hooks?
Hooks are a fundamental WordPress concept that allows developers to “hook into” specific points in the WordPress execution process. DigiFusion extends this concept by providing theme-specific hooks that correspond to different sections of your website’s layout.
There are two types of hooks:
- Action hooks – Allow you to add custom content or functionality
- Filter hooks – Allow you to modify existing content or data
DigiFusion primarily uses action hooks to provide insertion points throughout the theme.
Why Use DigiFusion’s Hook System?
The hook system offers several advantages:
Theme Update Safety: Your customizations remain intact when the theme updates, as you’re not modifying core theme files.
Clean Code Organization: Keep your customizations organized in your child theme’s functions.php file or in custom plugins.
Precise Control: Insert content exactly where you need it with surgical precision.
Professional Development: Follow WordPress best practices for theme customization.
Basic Hook Usage
To use a DigiFusion hook, add an action to your child theme’s functions.php file:
function my_custom_content() {
echo '<div class="my-custom-element">Custom content here</div>';
}
add_action( 'digifusion_hook_name', 'my_custom_content' );
Example: Adding a Banner After Header
function add_promotional_banner() {
echo '<div class="promo-banner">
<p>Special offer: 20% off all products this week!</p>
</div>';
}
add_action( 'digifusion_after_header', 'add_promotional_banner' );
Available Hooks by Section
WordPress Core Integration
wp_head – Inside the <head>
section
wp_footer – Before the closing </body>
tag
Site Wrapper Hooks
digifusion_before_wrapper – Before the main site wrapper
digifusion_after_wrapper – After the main site wrapper
Header Section Hooks
digifusion_before_header – Before the header container
digifusion_before_header_container – Before header inner container
digifusion_before_header_inner – Before header content
digifusion_before_header_logo – Before the site logo
digifusion_before_header_nav – Before the navigation menu
digifusion_before_header_menu – Before menu items
digifusion_before_header_menu_links – Before individual menu links
digifusion_after_header_menu_links – After individual menu links
digifusion_after_header_menu – After menu items
digifusion_after_header_inner – After header content
digifusion_after_header – After the entire header
Main Content Hooks
digifusion_before_main – Before main content area
digifusion_before_main_container – Before main container
digifusion_after_main_container – After main container
digifusion_after_main – After main content area
Page Header Hooks
digifusion_before_page_header – Before page header section
digifusion_before_page_header_content – Before page header content
digifusion_after_page_header_content – After page header content
digifusion_after_page_header – After page header section
Archive Page Hooks
digifusion_before_archive_content – Before archive content
digifusion_before_taxonomy_content – Before taxonomy content
digifusion_before_index_content – Before index content
digifusion_before_posts_grid – Before posts grid
digifusion_after_posts_grid – After posts grid
digifusion_after_archive_content – After archive content
digifusion_after_taxonomy_content – After taxonomy content
digifusion_after_index_content – After index content
Individual Post Hooks (Archive)
digifusion_before_archive_post – Before each post in archive
digifusion_before_archive_post_inner – Before post inner content
digifusion_before_archive_post_image – Before post featured image
digifusion_after_archive_post_image – After post featured image
digifusion_before_archive_post_content_inner – Before post content
digifusion_after_archive_post_meta – After post meta information
digifusion_after_archive_post_title – After post title
digifusion_before_archive_post_taxonomy – Before post categories/tags
digifusion_after_archive_post_taxonomy – After post categories/tags
digifusion_after_archive_post_content_inner – After post content
digifusion_after_archive_post_inner – After post inner content
digifusion_after_archive_post – After each post in archive
Single Post Hooks
digifusion_before_single_post – Before single post content
digifusion_before_single_post_inner – Before single post inner
digifusion_after_single_post_meta – After post meta
digifusion_after_single_post_featured_image – After featured image
digifusion_before_single_article_content – Before article content
digifusion_after_single_article_content – After article content
digifusion_before_author_box_inner – Before author box content
digifusion_after_author_box_inner – After author box content
digifusion_before_related_posts – Before related posts section
digifusion_before_related_posts_inner – Before related posts content
digifusion_after_related_posts_inner – After related posts content
digifusion_after_related_posts – After related posts section
digifusion_after_single_post_inner – After single post inner
digifusion_after_single_post – After single post content
Comments Section Hooks
digifusion_before_comments – Before comments section
digifusion_before_comments_inner – Before comments inner content
digifusion_before_comments_title – Before comments title
digifusion_after_comments_title – After comments title
digifusion_before_comment_form – Before comment form
digifusion_after_comments_inner – After comments inner content
digifusion_after_comments – After comments section
Page Hooks
digifusion_before_page_content – Before page content
digifusion_before_page_inner – Before page inner content
digifusion_after_page_inner – After page inner content
digifusion_after_page_content – After page content
Search Results Hooks
digifusion_before_search_results – Before search results
digifusion_before_search_results_inner – Before search results content
digifusion_after_search_results_inner – After search results content
digifusion_after_search_results – After search results
404 Error Page Hooks
digifusion_before_404_content – Before 404 content
digifusion_before_404_inner – Before 404 inner content
digifusion_after_404_inner – After 404 inner content
digifusion_after_404_content – After 404 content
No Results Hooks
digifusion_before_no_results – Before no results content
digifusion_before_no_results_content – Before no results message
digifusion_after_no_results_content – After no results message
digifusion_after_no_results – After no results content
Footer Section Hooks
digifusion_before_footer – Before footer container
digifusion_before_footer_container – Before footer inner container
digifusion_before_footer_widgets – Before footer widgets
digifusion_after_footer_widgets – After footer widgets
digifusion_before_footer_bottom – Before footer bottom section
digifusion_before_footer_copyright – Before copyright text
digifusion_after_footer_copyright – After copyright text
digifusion_after_footer_bottom – After footer bottom section
digifusion_after_footer_container – After footer inner container
digifusion_after_footer – After footer container
Practical Examples
Adding Social Media Icons to Header
function add_header_social_icons() {
echo '<div class="header-social-icons">
<a href="https://facebook.com/yourpage" target="_blank">Facebook</a>
<a href="https://twitter.com/yourhandle" target="_blank">Twitter</a>
<a href="https://instagram.com/yourprofile" target="_blank">Instagram</a>
</div>';
}
add_action( 'digifusion_after_header_menu_links', 'add_header_social_icons' );
Adding a Newsletter Signup Before Footer
function add_newsletter_signup() {
echo '<div class="newsletter-signup">
<div class="container">
<h3>Subscribe to Our Newsletter</h3>
<form method="post" action="/newsletter-signup">
<input type="email" name="email" placeholder="Enter your email" required>
<button type="submit">Subscribe</button>
</form>
</div>
</div>';
}
add_action( 'digifusion_before_footer', 'add_newsletter_signup' );
Adding Custom Meta Information to Posts
function add_custom_post_meta() {
if ( is_single() ) {
echo '<div class="custom-post-meta">
<span>Reading time: ' . get_post_meta( get_the_ID(), 'reading_time', true ) . ' minutes</span>
</div>';
}
}
add_action( 'digifusion_after_single_post_meta', 'add_custom_post_meta' );
Adding Advertisement Space in Archives
function add_archive_advertisement() {
if ( is_archive() && ! is_paged() ) {
echo '<div class="archive-ad">
<div class="ad-container">
<!-- Your advertisement code here -->
</div>
</div>';
}
}
add_action( 'digifusion_after_posts_grid', 'add_archive_advertisement' );
Advanced Hook Usage
Conditional Content Based on Page Type
function add_conditional_content() {
if ( is_front_page() ) {
echo '<div class="homepage-notice">Welcome to our website!</div>';
} elseif ( is_shop() && function_exists( 'is_shop' ) ) {
echo '<div class="shop-notice">Free shipping on orders over $50!</div>';
}
}
add_action( 'digifusion_after_header', 'add_conditional_content' );
Using Hook Priority
// This will run first (priority 5)
function first_function() {
echo '<div>This appears first</div>';
}
add_action( 'digifusion_after_header', 'first_function', 5 );
// This will run second (priority 10 - default)
function second_function() {
echo '<div>This appears second</div>';
}
add_action( 'digifusion_after_header', 'second_function' );
// This will run last (priority 20)
function third_function() {
echo '<div>This appears last</div>';
}
add_action( 'digifusion_after_header', 'third_function', 20 );
Best Practices
Use Child Themes: Always add your hook functions to a child theme’s functions.php file to preserve customizations during theme updates.
Check Context: Use conditional tags like is_home()
, is_single()
, is_archive()
to ensure your content appears only where intended.
Escape Output: Always sanitize and escape any user-generated content using functions like esc_html()
, esc_attr()
, and wp_kses()
.
Consider Performance: Avoid heavy database queries or complex operations in hook functions that run on every page load.
Test Thoroughly: Always test your customizations across different page types and devices to ensure they work as expected.
The DigiFusion hook system provides tremendous flexibility for customizing your website’s appearance and functionality. By understanding and utilizing these hooks effectively, you can create highly customized WordPress websites while maintaining clean, update-safe code.