Avada Hooks: Actions and Filters

Avada Hooks: Actions and Filters

11/12/2018

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.

Click Here To View The Fusion Builder Hooks Article

Overview

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, please click here and follow the instructions in the article.

Click Here To Read About Converting Child Themes and Custom Post Types

Actions List

Copy to Clipboard

File: Avada/includes/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

File: 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-layout.php
Avada/includes/woo-config.php
Avada/includes/class-avada-woocommerce.php
Avada/sensei/wrappers/wrapper-end.php
Avada/tribe-events/default-template.php

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

Arguments: None
Copy to Clipboard

File: 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 info 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

File: Avada/single.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 and post format boxes to medium alternate layout.

Arguments: None
Copy to Clipboard

File: Avada/footer.php

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

Arguments: None
Copy to Clipboard

File: Avada/includes/avada-functions.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/header.php

Description: This hook is executed right after the body tag.

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/side-header.php

Description: This hook is executed only when side header is used and after all content. An example usage would be to insert a widget area in the side header after all the content.

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/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-fusionredux.php

Description: This hook is executed after saving theme options.

Arguments: $data $changed_values
Copy to Clipboard

File: Avada/header.php

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

Arguments: $c_pageID
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
Copy to Clipboard
Copy to Clipboard
Copy to Clipboard
Copy to Clipboard
Copy to Clipboard
Copy to Clipboard
Copy to Clipboard

File: fusion-core/templates/single-avada_portfolio.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/templates/featured-image-first.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: 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

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/templates/featured-image-first.php

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

Arguments: $image_attr
Copy to Clipboard

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

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

Arguments: _Array of all cache modules.

Filters List

Copy to Clipboard

File: Avada/includes/class-avada-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/dynamic_css.php

Description: Applies to the array of all the elements that will be targeter 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

File: Avada/includes/dynamic_css.php

Description: Applied to the css styles for iPad Portrait.

Default Value: $ipad_portrait
Copy to Clipboard

File: Avada/templates/blog-layout.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/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/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/class-avada-head.php

Description: Applied to the viewport meta.

Default Value: none
Copy to Clipboard

File: Avada/includes/avada-functions.php

Description: Applies to video embeds in WP core when Fusion Builder is not active.

Default Value: $html.
Copy to Clipboard

File: Avada/includes/avada-functions.php

Description: Applied to the blog Read More title text.

Default Value: [...]
Copy to Clipboard

File: fusion-builder/shortcodes/fusion-blog.php

Description: Filters the HTML output of the blog element pagination.

Params: $output: The HTML output of the pagination.
$pages: Max number of pages.
$range: How many page numbers to display to either side of the current page.
$current_query: The query for which the pagination is constructed.
$blog_global_pagination: Global pagination style override.

Default Value: The pagination HTML output constructed by the blog element class.
Copy to Clipboard

File: fusion-builder/inc/lib/inc/class-fusion-cache.php fusion-builder/inc/lib/inc/class-fusion-dynamic-css.php fusion-builder/inc/lib/inc/class-fusion-filesystem.php, 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

File: fusion-builder/inc/lib/inc/class-fusion-cache.php fusion-builder/inc/lib/inc/class-fusion-dynamic-css.php fusion-builder/inc/lib/inc/class-fusion-filesystem.php, 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 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: fusion-builder/inc/lib/inc/class-fusion-filesystem.php, 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

File: Avada/includes/lib/inc/class-fusion-dynamic-js-file.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

File: Avada/includes/class-avada-layout.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/functions.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

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

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

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

Default Value: None.
Copy to Clipboard

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

Description: Applies to replaces iframe src.

Params: $content: Existing content.

Default Value: None

Recent Posts

Recent Tweets

For privacy reasons Twitter needs your permission to be loaded. For more details, please see our Privacy Policy.
I Accept