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_get_rendered_theme_styles( $theme_id )


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

$theme_id

(Required)


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/functions/themes/template.php

function pum_get_rendered_theme_styles( $theme_id ) {
	$styles = '';

	$theme = pum_get_theme( $theme_id );

	if ( ! pum_is_theme( $theme ) ) {
		return '';
	}

	$slug = $theme->post_name;

	$theme_styles = $theme->get_generated_styles();

	if ( empty( $theme_styles ) ) {
		return $styles;
	}

	foreach ( $theme_styles as $element => $element_rules ) {
		switch ( $element ) {

			case 'overlay':
				$css_selector = ".pum-theme-{$theme_id}";
				if ( $slug ) {
					$css_selector .= ", .pum-theme-{$slug}";
				}
				break;

			case 'container':
				$css_selector = ".pum-theme-{$theme_id} .pum-container";
				if ( $slug ) {
					$css_selector .= ", .pum-theme-{$slug} .pum-container";
				}
				break;

			case 'close':
				$css_selector = ".pum-theme-{$theme_id} .pum-content + .pum-close";
				$admin_bar_selector = "body.admin-bar .pum-theme-{$theme_id} .pum-content + .pum-close";
				if ( $slug ) {
					$css_selector .= ", .pum-theme-{$slug} .pum-content + .pum-close";
					$admin_bar_selector .= ", body.admin-bar .pum-theme-{$slug} .pum-content + .pum-close";
				}
				break;

			default:
				$css_selector = ".pum-theme-{$theme_id} .pum-{$element}";
				if ( $slug ) {
					$css_selector .= ", .pum-theme-{$slug} .pum-{$element}";
				}
				break;

		}

		$rule_set = $sep = '';
		foreach ( $element_rules as $property => $value ) {
			if ( ! empty( $value ) ) {
				$rule_set .= $sep . $property . ': ' . $value;
				$sep      = '; ';
			}
		}

		$styles .= "$css_selector { $rule_set } \r\n";

		if ( $element === 'close' && ! empty( $admin_bar_selector ) && $theme->get_setting( 'close_position_outside' ) && strpos( $theme->get_setting( 'close_location' ), 'top' ) !== false ) {
			$top = ! empty( $element_rules['top'] ) ? (int) str_replace( 'px', '', $element_rules['top'] ) : 0;
			// Move it down to compensate for admin bar height.
			$top += 32;
			$styles .= "$admin_bar_selector { top: {$top}px }";
		}

	}

	return $styles;
}


Top ↑

User Contributed Notes User Contributed Notes

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