Avada Hooks: Actions and Filters

Legacy Doc

Last Update: April 15, 2024

Actions and Filters are provided by WordPress to allow your plugin to ‘hook into’ the rest of WordPress; the same concept is used by Avada to allow hooking into Avada specific functionality so that you can modify it in a child theme or even a plugin.

How To Use a Hook Or A Filter?

So, let’s assume you want to add a banner ad before the entire header. There are three ways to do that:

1. Edit the parent theme’s code and add the code in the header file

2. Copy the header file into the child theme and modify the code in that file

3. Use an action in a child theme’s functions.php

With the #1 and #2 above, there is a high possibility that the edit would be lost during an update. By using an action, you don’t edit or overwrite the core code which is why, your code will rarely need to be changed.

To add a banner ad before the entire header, we need to use the “avada_before_header_wrapper” action in the functions.php of the child theme. Following is an example code:

Copy to Clipboard

Filters are similar to the actions but instead of ‘hooking’ into the code, you are simply changing the final output. You can read more about the difference difference between actions and filters from the beginner’s guide.

How To Add Code After The Opening Body Tag

To add code, such as GTM script, after the opening

Copy to Clipboard

tag, you will have to use the “avada_before_body_content” filter. If you’re not familiar with editing child theme files or you don’t have a child theme installed, you can install the Code Snippets plugin then add this code to it:

Copy to Clipboard

Conversion For Child Themes

If you’d like to learn how to convert Child Themes and your own Custom Post Types, see this link and follow the instructions in the article.

Actions List

Copy to Clipboard

Files:
Avada/includes/admin-screens/support.php
fusion-builder/inc/admin-screens/support.php

Description: This hook is executed after the content list is displayed on a support page.

Arguments: None.
Copy to Clipboard

File: Avada/page.php

Description: This hook is executed after additional content such as comment form on the single page.

Arguments: None.
Copy to Clipboard

File: Avada/single.php

Description: This hook is executed after additional content such as comments form on the single post.

Arguments: None.
Copy to Clipboard

Files:
fusion-core/templates/archive-avada_portfolio.php
fusion-core/templates/single-avada_portfolio.php
Avada/archive-wpfc_sermon.php
Avada/archive.php
Avada/author.php
Avada/bbpress.php
Avada/buddypress.php
Avada/contact.php
Avada/page.php
Avada/search.php
Avada/side-navigation.php
Avada/index.php
Avada/single-wpfc_sermon.php
Avada/single.php
Avada/taxonomy-wpfc_bible_book.php
Avada/taxonomy-wpfc_preacher.php
Avada/taxonomy-wpfc_sermon_series.php
Avada/taxonomy-wpfc_sermon_topics.php
Avada/includes/class-avada-woocommerce.php
Avada/sensei/wrappers/wrapper-end.php
Avada/tribe-events/default-template.php
fusion-builder/templates/template-page.php

Description: This hook is executed after the #content div primarily to add sidebars.

Arguments: None
Copy to Clipboard

Files:
Avada/includes/avada-functions.php
Avada/templates/side-header.php

Description: This hook is executed after the div that wraps the entire header (includes main header and top header).

Arguments: None
Copy to Clipboard

File: Avada/footer.php

Description: This hook is executed to display custom content just before the footer, outside of #main container.

Arguments: None
Copy to Clipboard

File: Avada/footer.php

Description: This hook is executed to display custom content right after #content and .sidebar containers, but still inside #main container.

Arguments: None
Copy to Clipboard

File: Avada/author.php

Description: This hook is executed on the author page to add author info.

Arguments: None
Copy to Clipboard

File: Avada/page.php

Description: This hook is executed before additional content such as comment form on the single page.

Arguments: None.
Copy to Clipboard

Files:
Avada/single.php
Avada/single-wpfc_sermon.php

Description: This hook is executed before additional content such as comments form on the single post.

Arguments: None.
Copy to Clipboard

File: Avada/header.php

Description: This hook is executed right after body tag in HTML.

Arguments: None
Copy to Clipboard

File: Avada/comments.php

Description: This hook is executed to display custom content just after the page contents, but before the comment section is displayed.

Arguments: None
Copy to Clipboard

File: Avada/includes/avada-functions.php Avada/templates/side-header.php

Description: This hook is executed before the div that wraps the entire header (includes main header and top header).

Arguments: None
Copy to Clipboard

File: Avada/header.php

Description: This hook is executed before the div id #main. An example usage would be to add AdSense before the content area.

Arguments: None
Copy to Clipboard

File: Avada/templates/blog-layout.php

Description: This hook renders the actual post content. Custom content can be displayed before or after the post content.

Arguments: None
Copy to Clipboard

File: Avada/templates/blog-layout.php

Description: This hook is executed to add blog post format boxes to medium alternate layout.

Arguments: None
Copy to Clipboard

File: Avada/footer.php

Description: This hook is executed to add content in the copyright area.

Arguments: None
Copy to Clipboard

Files:
Avada/includes/avada-functions.php
Avada/templates/side-header.php

Description: By default, this hook outputs the header, including top header and the main header.

Arguments: None
Copy to Clipboard

File: Avada/templates/side-header.php

Description: This hook is executed only when side header is used and before any kind of content including logo.

Arguments: None
Copy to Clipboard

File: Avada/templates/side-header.php

Description: This hook is executed right after side header wrapper.

Arguments: None
Copy to Clipboard

File: Avada/templates/logo.php

Description: This hook is executed directly after the logo html.

Arguments: None
Copy to Clipboard

File: Avada/templates/logo.php

Description: This hook is executed directly before the logo html.

Arguments: None
Copy to Clipboard

File: Avada/includes/custom-functions.php

Description: This hook will override the existing page title bar.

Arguments: $c_pageID
Copy to Clipboard

Files:
Avada/includes/lib/inc/templates/featured-image-first.php
fusion-builder/front-end/class-fusion-builder-front.php
fusion-builder/inc/lib/inc/templates/featured-image-first.php

Description: This hook is used to create a placeholder markup. Different markup can be used, when removing the theme action and adding a custom one.

Arguments: $post_featured_image_size
Copy to Clipboard

File: fusion-core/templates/portfolio-archive-layout.php

Description: This hook renders the actual portfolio content. Custom additions can be displayed before or after it by setting the corresponding hook priority.

Arguments: $archive_id $current_page_id
Copy to Clipboard

File: Avada/includes/lib/inc/templates/featured-image-first.php

Description: This hook is executed to add rollovers over images.

Arguments: $post_id $post_permalink $display_woo_price $display_woo_buttons $display_post_categories $display_post_title $gallery_id $display_woo_rating
Copy to Clipboard

File: Avada/includes/lib/inc/templates/rollover.php

Description: This hook is used to add the WooCommerce add to cart buttons to the featured image rollover.

Arguments: None
Copy to Clipboard

File: Avada/includes/lib/inc/class-fusion-patcher-admin-screen.php

Description: By default, this hook outputs the form on patcher page.

Arguments: None.
Copy to Clipboard
Copy to Clipboard

File: fusion-core/templates/single-avada_portfolio.php

Description: Allows you to add contents directly before and after the sharing box and related posts on single portfolio posts.

Params: None.
Copy to Clipboard
Copy to Clipboard

File: fusion-core/templates/single-avada_portfolio.php

Description: These actions allow you to add contents directly before and after the "Project Details" on single portfolio posts..

Params: None.
Copy to Clipboard

File: Avada/includes/lib/inc/class-fusion-cache.php

Description: This hook is executed after all fusion caches are cleared.

Arguments: None.
Copy to Clipboard

File: Avada/includes/lib/inc/class-fusion-fusionredux.php

Description: This hook is executed after saving theme options.

Arguments: $data $changed_values
Copy to Clipboard

File: Avada/contact.php

Description: This hook is executed to get contact template contents.

Arguments: None
Copy to Clipboard

File: Avada/header.php

Description: This hook is executed to render header.

Arguments: None
Copy to Clipboard

File: Avada/includes/avada-functions.php

Description: This hook can used to render content in div id #sliders-container.

Arguments: None
Copy to Clipboard

File: Avada/includes/avada-functions.php

Description: This hook can used to render content after div id #sliders-container.

Arguments: None
Copy to Clipboard

File: Avada/footer.php

Description: This hook is executed to render footer.

Arguments: None
Copy to Clipboard

File: Avada/footer.php

Description: This hook can be used to add content just before #wrapper is closed.

Arguments: None
Copy to Clipboard

File: Avada/templates/wc-quick-view-product.php

Description: This hook is executed to get WooCommerce produce quick view content.

Arguments: None

Filters List

Copy to Clipboard

File: Avada/includes/admin-screens/welcome.php

Description: This hook can be used to modify admin welcome screen content.

Arguments: $welcome_html
Copy to Clipboard

File: Avada/includes/lib/inc/class-fusion-social-icons.php

Description: This hook can be used to modify social icons content.

Arguments: $html, $args
Copy to Clipboard

File: Avada/includes/lib/inc/class-fusion-social-sharing.php

Description: This hook can be used to modify social sharing content.

Arguments: $html, $args
Copy to Clipboard

File: Avada/includes/lib/inc/functions.php

Description: This hook can be used to modify post meta data content.

Arguments: $html
Copy to Clipboard

File: Avada/includes/lib/inc/class-fusion-cache.php

Description: Setting one of the array variables to false will make the clearing function skip that module.

Arguments: _Array of all cache modules.
Copy to Clipboard

File: Avada/includes/lib/inc/templates/featured-image-first.php

Description: This hook is used to modify related post's fixed image attributes.

Arguments: $image_attr
Copy to Clipboard
Copy to Clipboard

File: Avada/includes/fusion-functions.php

Description: fusion_related_posts_args hook can be used to modify related custom post's arguments. While fusion_related_posts_query_args can be used for default posts.

Arguments: $args (array)
Copy to Clipboard
Copy to Clipboard
Copy to Clipboard
Copy to Clipboard
Copy to Clipboard
Copy to Clipboard
Copy to Clipboard
Copy to Clipboard

Files:
fusion-core/templates/single-avada_portfolio.php
fusion-core/shortcodes/components/templates/fusion-tb-project-details.php

Description: These filters allow to set custom labels for all the portfolio meta data parts on the right of the contents.

Arguments: All include the markup we use by default. Check file for details.
Copy to Clipboard

File: Avada/includes/lib/inc/class-fusion-breadcrumbs.php

Description: Applied to the default values of breadcrumb.

Default Value: array( 'home_prefix' => $this->options['breacrumb_prefix'], 'separator' => $this->options['breadcrumb_separator'], 'show_post_type_archive' => $this->options['breadcrumb_show_post_type_archive'], 'show_terms' => $this->options['breadcrumb_show_categories'], 'home_label' => __( 'Home', 'Avada' ), 'tag_archive_prefix' => __( 'Tag:', 'Avada' ), 'search_prefix' => __( 'Search:', 'Avada' ), 'error_prefix' => __( '404 - Page not Found', 'Avada' ), );
Copy to Clipboard

File: Avada/includes/class-avada-dynamic-css.php

Description: Applied to the final compiled CSS from dynamic CSS.

Default Value: $css
Copy to Clipboard

File: Avada/includes/dynamic_css.php

Description: Applied to the dynamic CSS array.

Default Value: $css
Copy to Clipboard

File: Avada/includes/class-avada-privacy-embeds.php

Description: Applies to iframe placeholder consent text when privacy mode is active.

Params: $content: Existing content.
$label: Label text of particular embed type.

$type: Type slug of embed type.

Default Value: None
Copy to Clipboard
Copy to Clipboard
Copy to Clipboard
Copy to Clipboard
Copy to Clipboard
Copy to Clipboard
Copy to Clipboard
Copy to Clipboard

File: Avada/includes/options/typography.php

Description: Applies to the array of all the elements that will be targeted from the typography settings.

Default Value: $typography_elements
Copy to Clipboard

File: Avada/includes/avada-functions.php

Description: Applied to the email address in top header.

Default Value: %s
Copy to Clipboard

File: Avada/includes/avada-functions.php

Description: Separator for top header content, not menu.

Default Value: |
Copy to Clipboard

Files:
Avada/templates/blog-layout.php
fusion-builder/front-end/templates/fusion-recent-posts.php
fusion-builder/shortcodes/fusion-blog.php
fusion-builder/shortcodes/fusion-recent-posts.php

Description: Applied to the text for the load more button.

Default Value: __( 'Load More Posts', 'Avada' )
Copy to Clipboard

File: Avada/templates/logo.php

Description: Filters the alt attribute added to the main site logo image.

Default Value: get_bloginfo( 'name', 'display' ) . ' ' . __( 'Logo', 'Avada' ).
Copy to Clipboard

File: Avada/includes/metaboxes/metaboxes.php

Description: Allows developers to add their own tabs to the Fusion Page Options setup.

Arguments: $tabs $post_type

Example Usage Code: In child theme's function.php, this would add a new section to portfolio post type: https://gist.github.com/ilicfilip/8c4221bbb6eeb7aafe3e14ba95e18f46. In a separate file, this defines the actual options: https://gist.github.com/ilicfilip/9a7becc01bf53dda0fb4edf42268da7c. In any child theme template file, the developer can access the settings like this e.g: get_post_meta( $post->ID, 'pyre_child_video', true );
Copy to Clipboard

File: Avada/includes/lib/inc/class-fusion-nav-walker.php

Description: Allows developers to modify meta data of menu items.

Arguments: $fusion_meta $item_id

Copy to Clipboard

File: Avada/includes/lib/inc/class-fusion-data-postmeta.php

Description: Allows developers to modify meta data of a post/page.

Arguments: $data $post_id

Copy to Clipboard

File: Avada/templates/logo.php

Description: Filters the HTML attributes on the site logo anchor tag.

Default Value: array( 'class' => 'fusion-logo-link', 'href' => ( $custom_link = Avada()->settings->get( 'logo_custom_link' ) ) ? esc_url( $custom_link ) : esc_url( home_url( '/' ) ), )
Copy to Clipboard

File: Avada/includes/lib/inc/class-fusion-nav-walker.php

Description: Filters the menu item index after wich the logo will be displayed.

Default Value: $middle_logo_menu_break_point, value depending on amount of set menu items.
Copy to Clipboard

File: Avada/includes/lib/inc/class-fusion-helper.php

Description: Allows for easy filtering of the page title bar markup and contents.

Default Value: array( $title, $subtitle, $secondary_content )
Copy to Clipboard

File: Avada/includes/class-avada-init.php

Description: Filter is used to modify search results content by post type.

Arguments: $post_types (string | array )

Copy to Clipboard

File: Avada/includes/avada-functions.php

Description: Filters the left/right content output in the secondary (top) header.

Arguments: $secondary_content:string. The actual content to be output.
$content_area:string. The content area where content should be displayed.
$content_to_display:string. The kind of content to be retrieved.

Default Value: (The secondary header content as set in Theme Options.)

File: Avada/includes/avada-functions.php

Description: Applied to the placeholder image height.

Default Value: 150
Copy to Clipboard

File: Avada/includes/class-avada-layout.php

Description: Allows to filter the main sidebar settings for single post template of posts and CPTs.

Default Value: array() with indices 'global', 'sidebar_1, 'sidebar_2', 'position'
Copy to Clipboard

File: Avada/includes/avada-functions.php

Description: Applied to an array of classes added to html element.

Default Value: $classes
Copy to Clipboard

File: Avada/includes/class-avada-head.php

Description: Applied to the viewport meta.

Default Value: none
Copy to Clipboard

Files:
Avada/includes/lib/inc/functions.php
fusion-builder/front-end/class-fusion-builder-front.php
fusion-builder/inc/helpers.php

Description: Applied to the blog Read More title text.

Default Value: [...]
Copy to Clipboard

Files:
Avada/includes/lib/inc/class-fusion-cache.php
Avada/includes/lib/inc/class-fusion-dynamic-css.php
Avada/includes/lib/inc/class-fusion-filesystem.php

Description: Changes the fusion-scripts and fusion-styles folders that are created inside the root paths.

Default Value: Defaults to 'fusion-scripts' for JS files and 'fusion-styles' for CSS files.
Copy to Clipboard

Files:
Avada/includes/lib/inc/class-fusion-cache.php
Avada/includes/lib/inc/class-fusion-filesystem.php

Description: Changes the path of the root folder where files are being compiled.

Default Value: Defaults to the full system-path of wp-content/uploads.
Copy to Clipboard

File: Avada/includes/lib/inc/class-fusion-filesystem.php

Description: Changes the URL of the root folder where files are being compiled.

Default Value: Defaults to the url of wp-content/uploads.
Copy to Clipboard

Files:
Avada/includes/lib/inc/class-fusion-dynamic-js-file.php
Avada/includes/options/performance.php

Description: If the site/host falsely reports that the JS files can't be read but it still does work correctly, readability can be forced to yes through the filter and thus the compiled JS file can be loaded on the front end.

Default Value: bool, true if JS file is readable.
Copy to Clipboard

File: fusion-core/shortcodes/fusion-faq.php

Description: Applied to the "All" text on the portfolio filters.

Default Value: __( 'All', 'Avada' )
Copy to Clipboard

Files:
Avada/includes/avada-functions.php
Avada/header.php
fusion-builder/shortcodes/fusion-container.php

Description: Applies to check if current page is a 100% width page.

Params: $value: The value from the filter.
$page_id: A custom page ID.

Default Value: None.
Copy to Clipboard

File: Avada/includes/lib/inc/class-fusion-settings.php

Description: Applies to theme options label on description texts.

Default Value: None.
Copy to Clipboard

File: Avada/includes/metaboxes/metaboxes.php

Description: Adds an OR argument to the if clause deciding on what pages the Fusion Page Options should be shown.

Default Value: false
Copy to Clipboard

Files:
Avada/includes/lib/inc/functions.php
fusion-builder/inc/lib/inc/functions.php

Description: Allows to set the amount of page links shown left and right to the current element.

Params: $range

Default Value: 1
Copy to Clipboard

File: Avada/includes/class-avada-privacy-embeds.php

Description: Applies to set the args for the privacy cookie.

Default Value: $default_args = array( 'name' => 'privacy_embeds', 'days' => '30', 'path' => '/', );
Copy to Clipboard

File: Avada/includes/class-avada-privacy-embeds.php

Description: Applies to change available embeds.

Default Value: $embeds
Copy to Clipboard

Files:
Avada/includes/class-avada-googlemap.php
Avada/includes/lib/inc/templates/featured-image-first.php
Avada/new-slideshow.php
Avada/templates/featured-image-page.php
Avada/templates/featured-image-post.php
Avada/templates/featured-image-wpfc_sermon.php
fusion-builder/shortcodes/fusion-google-map.php

Description: Applies to replaces iframe src.

Params: $content: Existing content.

Default Value: None
Copy to Clipboard

Files: Avada/includes/class-avada-privacy-embeds.php

Description: Allows custom placeholder additions.

Params: $placeholder $type $frame_width $frame_height $src

Copy to Clipboard

File: Avada/includes/avada-functions.php

Default: The main heading name, dependednt on the post type.

Params: $post_type the type of the current post.
Copy to Clipboard

File: Avada/includes/dynamic_css.php

Description: This hook is used to modify content and sidebar order in responsive mode.

Arguments: $sidebar_order
Copy to Clipboard

File: Avada/templates/social-sharing.php

Description: Sets a custom sharing box tagline. This will override the setting in Theme Options.

Default Value: "Share This Story!" (can be set in Theme Options)
Copy to Clipboard
Copy to Clipboard

Files:
Avada/templates/sidebar-1.php
Avada/templates/sidebar-2.php

Description: Applies to add classes to first and second sidebar.

Default Value: None.
Copy to Clipboard
Copy to Clipboard

Files: Avada/includes/class-avada-template.php

Description: Applies to check if current page has got single or dual sidebars.

Params: Bool, $body_classes, $sidebar_class