0

I reworded this question to show mine is a general question that is not totally depending on a 3rd theme/plugin.

I have read this How to know what functions are hooked to an action/filter?. It seems very simple: $wp_filters['action_name'] contains the callback functions that are hooked to the action. However, in my case, it seems there are some other hidden functions that can't be found in this way.

For learning purpose, I am working on https://websitedemos.net/blog-02/ this page, which is an Astra theme starter template, to find out how the hero image gets rendered.

It is an Astra custom layout built using Elementor, I am trying to understand how Astra theme calls the callback function for the hero image. enter image description here

So far, I've found the action, it is astra_header_afterin Astra's header.php file

astra_header_before();
astra_header();  //I I comment out this line, the Nav bar is gone but the hero image remains.
astra_header_after(); // If I comment out this line, the hero image won't show
astra_content_before();
.............
function astra_header_after() {
    do_action( 'astra_header_after' );
}

A full text search for astra_header_after returns enter image description here And this is the only line adding callback function to astra_header_after. So it seems to me this load_markup method is the only callback function that is hooked to astra_header_after.

Then I go to look at this load_markup method, and I can't find the code that will connect to elementor and render the hero image. Actually, even if I comment out every line in this load_markup method, the hero image still gets rendered.

public function load_markup() {

        // Get our options.
        $advanced_headers_layout         = Astra_Ext_Advanced_Headers_Loader::astra_advanced_headers_layout_option( 'layout' );
        $advanced_headers_merged         = Astra_Ext_Advanced_Headers_Loader::astra_advanced_headers_layout_option( 'merged' );
        $advanced_header_bg_size         = Astra_Ext_Advanced_Headers_Loader::astra_advanced_headers_design_option( 'bg-size' );
        $advanced_header_parallax_device = Astra_Ext_Advanced_Headers_Loader::astra_advanced_headers_design_option( 'parallax-device' );

        if ( ! self::advanced_header_enabled() || ( is_front_page() && 'posts' == get_option( 'show_on_front' ) ) ) {
            return;
        }

        if ( ! $advanced_headers_merged ) {
            $combined = 'ast-title-bar-wrap';

            // Parallax variable.
            $parallax = ( 'none' !== $advanced_header_parallax_device ) ? '  ast-advanced-headers-parallax' : '';
            // Parallax Device.
            $parallax_device = ( 'none' !== $advanced_header_parallax_device ) ? $advanced_header_parallax_device : '';
            // Parallax speed variable.
            $parallax_speed = apply_filters( 'astra_advanced_header_parallax_speed', 2 );
            // Full Screen vertical align center.
            $vertical_center = ' ast-advanced-headers-vertical-center';
            // Full Screen.
            $full_screen = ( 'full-screen' == $advanced_header_bg_size ) ? ' ast-full-advanced-header' : '';

            // Add advanced header wrapper classes.
            printf(
                '<div class="%1$s" %2$s role="img" %3$s>',
                $combined . $parallax . $full_screen . $vertical_center,
                ( ! empty( $parallax ) ) ? 'data-parallax-speed="' . esc_attr( $parallax_speed ) . '" data-parallax-device="' . esc_attr( $parallax_device ) . '"' : '',
                $this->get_header_background_image_alt_text() // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
            );
        }

        if ( 'disable' !== $advanced_headers_layout ) {
            // Add markup.
            astra_get_template( 'advanced-headers/template/' . $advanced_headers_layout . '.php' );
        }

        echo '</div>';

        // Page Header with no content is selected.
        if ( 'disable' != $advanced_headers_layout ) {
            add_filter( 'astra_the_title_enabled', '__return_false' );
        }

    }

Now I wonder if there is any other callback function hooked to astra_header_after. So I use the code in this answer to check all the callback functions that are hooked to it. Here is the output: enter image description here

There seems to be no other callback function than load_markup. So, I am stuck here. Can anyone tell me how to investigate further on this issue? Thanks.

1
  • Have you tried using query monitor? Its a great plugin we developing in wordpress, theres a section about hooks that gives you information about all the action in the current page Jul 24 at 10:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.