Astra_Ext_Advanced_Hooks_Markup::get_action_content( int $post_id )

Advanced Hooks get content


Description

Loads content


Parameters

$post_id

(int) (Required) post id.


Source

File: addons/advanced-hooks/classes/class-astra-ext-advanced-hooks-markup.php

		public function get_action_content( $post_id ) {

			if ( false === apply_filters( 'astra_addon_render_custom_layout_content', true, $post_id ) ) {
				return;
			}

			if ( ! static::get_time_duration_eligibility( $post_id ) ) {
				return;
			}

			$action                 = get_post_meta( $post_id, 'ast-advanced-hook-action', true );
			$display_device_classes = $this->get_display_device( $post_id );

			// Exclude div wrapper if selected hook is from below list.
			$exclude_wrapper_hooks = array( 'astra_html_before', 'astra_body_top', 'astra_head_top', 'astra_head_bottom', 'wp_head', 'astra_body_bottom', 'wp_footer' );
			$with_wrapper          = ! in_array( $action, $exclude_wrapper_hooks );
			if ( $with_wrapper ) {
				echo '<div class="astra-advanced-hook-' . esc_attr( $post_id ) . ' ' . esc_attr( $display_device_classes ) . '">';
			}

			$php_snippet = $this->get_php_snippet( $post_id );
			if ( $php_snippet ) {
				echo $php_snippet; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped

			} else {

				if ( class_exists( 'Astra_Addon_Page_Builder_Compatibility' ) ) {

					$page_builder_base_instance = Astra_Addon_Page_Builder_Compatibility::get_instance();

					$page_builder_instance = $page_builder_base_instance->get_active_page_builder( $post_id );

					$page_builder_instance->render_content( $post_id );

				}
			}

			if ( $with_wrapper ) {
				echo '</div>';
			}
		}

Changelog

Changelog
Version Description
1.0.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.