Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808

Warning: foreach() argument must be of type array|object, string given in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 813

Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808
PUM_Site_Popups::check_content_for_popups( string $content )

Checks post content to see if there are popups we need to automagically load


Description Description


Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808

Warning: foreach() argument must be of type array|object, string given in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 813

Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808

Parameters Parameters

$content

(Required) The content from the filter.


Top ↑

Return Return

(string) The content.


Top ↑

Source Source

File: classes/Site/Popups.php

	public static function check_content_for_popups( $content ) {

		// Only search for popups in the main query of a singular page.
		if ( is_singular() && in_the_loop() && is_main_query() ) {
			/**
			 * We want to detect instances of popmake-### but only within classes and not in the actual text.
			 * So, we check to make sure it is wrapped by quotes to make sure it's in the class="" attribute
			 * but also allow for whitespace and characters in case there are classes before or after it.
			 */
			preg_match_all( '/[\'\"][\s\w\-\_]*?popmake-(\d+)[\s\w\-\_]*?[\'\"]/', $content, $matches );

			// Then, if we find any popups, let's preload it.
			foreach ( $matches[1] as $popup_id ) {
				self::preload_popup_by_id_if_enabled( $popup_id );
			}
		}

		return $content;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
1.15 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

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