Avada Hooks: Actions and Filters
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:
add_action( 'avada_before_header_wrapper', 'avada_add_banner' );
function avada_add_banner() {
echo '<img class="lazyload" decoding="async" src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" data-orig-src="http://domain.com/ad.png" alt="Ad Banner" />';
}
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
<body>
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:
function my_custom_head_function_for_avada() {
?>
ADD YOUR CONTENT HERE
<?php
}
add_filter( 'avada_before_body_content', 'my_custom_head_function_for_avada' );
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
xxxxxxxxxx
avada_admin_pages_support_after_list
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.xxxxxxxxxx
avada_after_additional_page_content
File: Avada/page.php
Description: This hook is executed after additional content such as comment form on the single page.
Arguments: None.xxxxxxxxxx
avada_after_additional_post_content
File: Avada/single.php
Description: This hook is executed after additional content such as comments form on the single post.
Arguments: None.xxxxxxxxxx
avada_after_content
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: Nonexxxxxxxxxx
avada_after_header_wrapper
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: Nonexxxxxxxxxx
avada_after_main_container
File: Avada/footer.php
Description: This hook is executed to display custom content just before the footer, outside of #main container.
Arguments: Nonexxxxxxxxxx
avada_after_main_content
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: Nonexxxxxxxxxx
avada_author_info
File: Avada/author.php
Description: This hook is executed on the author page to add author info.
Arguments: Nonexxxxxxxxxx
avada_before_additional_page_content
File: Avada/page.php
Description: This hook is executed before additional content such as comment form on the single page.
Arguments: None.xxxxxxxxxx
avada_before_additional_post_content
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.xxxxxxxxxx
avada_before_body_content
File: Avada/header.php
Description: This hook is executed right after body tag in HTML.
Arguments: Nonexxxxxxxxxx
avada_before_comments
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: Nonexxxxxxxxxx
avada_before_header_wrapper
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: Nonexxxxxxxxxx
avada_before_main_container
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: Nonexxxxxxxxxx
avada_blog_post_content
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: Nonexxxxxxxxxx
avada_blog_post_date_and_format
File: Avada/templates/blog-layout.php
Description: This hook is executed to add blog post format boxes to medium alternate layout.
Arguments: Nonexxxxxxxxxx
avada_footer_copyright_content
File: Avada/footer.php
Description: This hook is executed to add content in the copyright area.
Arguments: Nonexxxxxxxxxx
avada_header
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: Nonexxxxxxxxxx
avada_header_inner_after
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: Nonexxxxxxxxxx
avada_header_inner_before
File: Avada/templates/side-header.php
Description: This hook is executed right after side header wrapper.
Arguments: Nonexxxxxxxxxx
avada_logo_append
File: Avada/templates/logo.php
Description: This hook is executed directly after the logo html.
Arguments: Nonexxxxxxxxxx
avada_logo_prepend
File: Avada/templates/logo.php
Description: This hook is executed directly before the logo html.
Arguments: Nonexxxxxxxxxx
avada_override_current_page_title_bar
File: Avada/includes/custom-functions.php
Description: This hook will override the existing page title bar.
Arguments: $c_pageIDxxxxxxxxxx
avada_placeholder_image
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_sizexxxxxxxxxx
avada_portfolio_post_content
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_idxxxxxxxxxx
avada_rollover
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_ratingxxxxxxxxxx
avada_woocommerce_buttons_on_rollover
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: Nonexxxxxxxxxx
fusion_admin_pages_patcher
File: Avada/includes/lib/inc/class-fusion-patcher-admin-screen.php
Description: By default, this hook outputs the form on patcher page.
Arguments: None.xxxxxxxxxx
fusion_before_additional_portfolio_content
xxxxxxxxxx
fusion_after_additional_portfolio_content
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.xxxxxxxxxx
fusion_before_portfolio_side_content
xxxxxxxxxx
fusion_after_portfolio_side_content
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.xxxxxxxxxx
fusion_cache_reset_after
File: Avada/includes/lib/inc/class-fusion-cache.php
Description: This hook is executed after all fusion caches are cleared.
Arguments: None.xxxxxxxxxx
fusion_options_save
File: Avada/includes/lib/inc/class-fusion-fusionredux.php
Description: This hook is executed after saving theme options.
Arguments: $data $changed_valuesxxxxxxxxxx
avada_add_contact_template_contents
File: Avada/contact.php
Description: This hook is executed to get contact template contents.
Arguments: Nonexxxxxxxxxx
avada_render_header
File: Avada/header.php
Description: This hook is executed to render header.
Arguments: Nonexxxxxxxxxx
avada_sliders_inside_container_start
File: Avada/includes/avada-functions.php
Description: This hook can used to render content in div id #sliders-container.
Arguments: Nonexxxxxxxxxx
avada_sliders_inside_container_end
File: Avada/includes/avada-functions.php
Description: This hook can used to render content after div id #sliders-container.
Arguments: Nonexxxxxxxxxx
avada_render_footer
File: Avada/footer.php
Description: This hook is executed to render footer.
Arguments: Nonexxxxxxxxxx
avada_before_wrapper_container_close
File: Avada/footer.php
Description: This hook can be used to add content just before #wrapper is closed.
Arguments: Nonexxxxxxxxxx
fusion_quick_view_summary_content
File: Avada/templates/wc-quick-view-product.php
Description: This hook is executed to get WooCommerce produce quick view content.
Arguments: NoneFilters List
xxxxxxxxxx
avada_admin_welcome_screen_content
File: Avada/includes/admin-screens/welcome.php
Description: This hook can be used to modify admin welcome screen content.
Arguments: $welcome_htmlxxxxxxxxxx
fusion_social_icons_html
File: Avada/includes/lib/inc/class-fusion-social-icons.php
Description: This hook can be used to modify social icons content.
Arguments: $html, $argsxxxxxxxxxx
fusion_social_sharing_html
File: Avada/includes/lib/inc/class-fusion-social-sharing.php
Description: This hook can be used to modify social sharing content.
Arguments: $html, $argsxxxxxxxxxx
fusion_post_metadata_markup
File: Avada/includes/lib/inc/functions.php
Description: This hook can be used to modify post meta data content.
Arguments: $htmlxxxxxxxxxx
reset_all_caches
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.xxxxxxxxxx
fusion_related_posts_image_attr
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_attrxxxxxxxxxx
fusion_related_posts_args
xxxxxxxxxx
fusion_related_posts_query_args
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)xxxxxxxxxx
fusion_portfolio_post_project_description_label
xxxxxxxxxx
fusion_portfolio_post_project_details_label
xxxxxxxxxx
fusion_portfolio_post_skills_label
xxxxxxxxxx
fusion_portfolio_post_categories_label
xxxxxxxxxx
fusion_portfolio_post_tags_label
xxxxxxxxxx
fusion_portfolio_post_project_url_label
xxxxxxxxxx
fusion_portfolio_post_copyright_label
xxxxxxxxxx
fusion_portfolio_post_author_label
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.xxxxxxxxxx
fusion_breadcrumbs_defaults
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' ), );xxxxxxxxxx
avada_dynamic_css
File: Avada/includes/class-avada-dynamic-css.php
Description: Applied to the final compiled CSS from dynamic CSS.
Default Value: $cssxxxxxxxxxx
avada_dynamic_css_array
File: Avada/includes/dynamic_css.php
Description: Applied to the dynamic CSS array.
Default Value: $cssxxxxxxxxxx
avada_embeds_consent_text
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.
xxxxxxxxxx
avada_h1_typography_elements
xxxxxxxxxx
avada_h2_typography_elements
xxxxxxxxxx
avada_h3_typography_elements
xxxxxxxxxx
avada_h4_typography_elements
xxxxxxxxxx
avada_h5_typography_elements
xxxxxxxxxx
avada_h6_typography_elements
xxxxxxxxxx
avada_post_title_typography_elements
xxxxxxxxxx
avada_post_title_extras_typography_elements
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_elementsxxxxxxxxxx
avada_header_contact_info_email
File: Avada/includes/avada-functions.php
Description: Applied to the email address in top header.
Default Value: %sxxxxxxxxxx
avada_header_separator
File: Avada/includes/avada-functions.php
Description: Separator for top header content, not menu.
Default Value: |xxxxxxxxxx
avada_load_more_posts_name
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' )xxxxxxxxxx
avada_logo_alt_tag
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' ).xxxxxxxxxx
avada_metabox_tabs
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 );xxxxxxxxxx
avada_menu_meta
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
xxxxxxxxxx
fusion_get_all_meta
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
xxxxxxxxxx
avada_logo_anchor_tag_attributes
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( '/' ) ), )xxxxxxxxxx
avada_middle_logo_menu_break_point
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.xxxxxxxxxx
avada_page_title_bar_contents
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 )xxxxxxxxxx
avada_search_results_post_types
File: Avada/includes/class-avada-init.php
Description: Filter is used to modify search results content by post type.
Arguments: $post_types (string | array )
xxxxxxxxxx
avada_secondary_header_content
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.
xxxxxxxxxx
avada_set_placeholder_image_height
File: Avada/includes/avada-functions.php
Description: Applied to the placeholder image height.
Default Value: 150xxxxxxxxxx
avada_single_post_sidebar_theme_option
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'xxxxxxxxxx
avada_the_html_class
File: Avada/includes/avada-functions.php
Description: Applied to an array of classes added to html element.
Default Value: $classesxxxxxxxxxx
avada_viewport_meta
File: Avada/includes/class-avada-head.php
Description: Applied to the viewport meta.
Default Value: nonexxxxxxxxxx
fusion_blog_read_more_excerpt
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: [...]xxxxxxxxxx
fusion_compiler_filesystem_folder_name
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.xxxxxxxxxx
fusion_compiler_filesystem_root_path
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.xxxxxxxxxx
fusion_compiler_filesystem_root_url
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.xxxxxxxxxx
fusion_compiler_js_file_is_readable
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.xxxxxxxxxx
fusion_faq_all_filter_name
File: fusion-core/shortcodes/fusion-faq.php
Description: Applied to the "All" text on the portfolio filters.
Default Value: __( 'All', 'Avada' )xxxxxxxxxx
fusion_is_hundred_percent_template
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.
xxxxxxxxxx
fusion_options_label
File: Avada/includes/lib/inc/class-fusion-settings.php
Description: Applies to theme options label on description texts.
Default Value: None.xxxxxxxxxx
fusion_page_options_init
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: falsexxxxxxxxxx
fusion_pagination_size
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: 1xxxxxxxxxx
fusion_privacy_cookie_args
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' => '/', );xxxxxxxxxx
fusion_privacy_embeds
File: Avada/includes/class-avada-privacy-embeds.php
Description: Applies to change available embeds.
Default Value: $embedsxxxxxxxxxx
privacy_iframe_embed
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: Nonexxxxxxxxxx
avada_privacy_placeholder
Files: Avada/includes/class-avada-privacy-embeds.php
Description: Allows custom placeholder additions.
Params: $placeholder $type $frame_width $frame_height $src
xxxxxxxxxx
fusion_related_posts_heading_text
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.xxxxxxxxxx
fusion_responsive_sidebar_order
File: Avada/includes/dynamic_css.php
Description: This hook is used to modify content and sidebar order in responsive mode.
Arguments: $sidebar_orderxxxxxxxxxx
fusion_sharing_box_tagline
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)xxxxxxxxxx
fusion_sidebar_1_class
xxxxxxxxxx
fusion_sidebar_2_class
Files:
Avada/templates/sidebar-1.php
Avada/templates/sidebar-2.php
Description: Applies to add classes to first and second sidebar.
Default Value: None.xxxxxxxxxx
avada_has_sidebar
xxxxxxxxxx
avada_has_double_sidebars
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