Astra_Ext_Advanced_Hooks_Markup::advanced_hook_content_markup( html $content )

Filter content markup for Advanced Hook post type.


Description


Parameters

$content

(html) (Required) the_content markup.


Return

(html)


Source

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

		public function advanced_hook_content_markup( $content ) {
			if ( is_singular( ASTRA_ADVANCED_HOOKS_POST_TYPE ) ) {
				$post_id = get_the_id();

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

				$php_snippet = $this->get_php_snippet( $post_id );
				if ( $php_snippet ) {
					$content = $php_snippet;
				}

				$display_device_classes = $this->get_display_device( $post_id );

				$action = get_post_meta( $post_id, 'ast-advanced-hook-action', true );
				// 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 ) {
					$content = '<div class="astra-advanced-hook-' . esc_attr( $post_id ) . ' ' . esc_attr( $display_device_classes ) . '">' . $content . '</div>';
				}
			}
			return $content;
		}

User Contributed Notes

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