erwise.
*/
public static function is_cpt_custom_templates_supported() {
require_once ABSPATH . '/wp-admin/includes/theme.php';
return method_exists( wp_get_theme(), 'get_post_templates' );
}
/**
* @since 2.1.2
* @access public
* @static
*/
public static function array_inject( $base_array, $key, $insert ) {
$length = array_search( $key, array_keys( $base_array ), true ) + 1;
return array_slice( $base_array, 0, $length, true ) +
$insert +
array_slice( $base_array, $length, null, true );
}
/**
* Render html attributes
*
* @access public
* @static
* @param array $attributes
*
* @return string
*/
public static function render_html_attributes( array $attributes ) {
$rendered_attributes = [];
foreach ( $attributes as $attribute_key => $attribute_values ) {
if ( is_array( $attribute_values ) ) {
$attribute_values = implode( ' ', $attribute_values );
}
$rendered_attributes[] = sprintf( '%1$s="%2$s"', $attribute_key, esc_attr( $attribute_values ) );
}
return implode( ' ', $rendered_attributes );
}
/**
* Safe print html attributes
*
* @access public
* @static
* @param array $attributes
*/
public static function print_html_attributes( array $attributes ) {
// PHPCS - the method render_html_attributes is safe.
echo self::render_html_attributes( $attributes ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
public static function get_meta_viewport( $context = '' ) {
$meta_tag = '';
/**
* Viewport meta tag.
*
* Filters the meta tag containing the viewport information.
*
* This hook can be used to change the initial viewport meta tag set by Elementor
* and replace it with a different viewport tag.
*
* @since 2.5.0
*
* @param string $meta_tag Viewport meta tag.
* @param string $context Page context.
*/
$meta_tag = apply_filters( 'elementor/template/viewport_tag', $meta_tag, $context );
return $meta_tag;
}
/**
* Add Elementor Config js vars to the relevant script handle,
* WP will wrap it with