| @@ -6,13 +6,13 @@ | ||
| 6 | 6 | use Elementor\Core\Base\Module as BaseModule; |
| 7 | 7 | use Elementor\Core\Kits\Documents\Kit; |
| 8 | 8 | use Elementor\Plugin; |
| 9 | 9 | use Elementor\Utils; |
| 10 | -use Elementor\Core\DocumentTypes\PageBase; | |
| 10 | +use Elementor\Core\DocumentTypes\PageBase as PageBase; | |
| 11 | 11 | use Elementor\Modules\Library\Documents\Page as LibraryPageDocument; |
| 12 | 12 | |
| 13 | 13 | if ( ! defined( 'ABSPATH' ) ) { |
| 14 | - exit; // Exit if accessed directly. | |
| 14 | + exit; // Exit if accessed directly | |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * Elementor page templates module. |
| @@ -133,11 +133,13 @@ | ||
| 133 | 133 | * @since 2.0.0 |
| 134 | 134 | * @access public |
| 135 | 135 | * @static |
| 136 | 136 | * |
| 137 | - * @param array $page_templates Array of page templates. Keys are filenames, checks are translated names. | |
| 137 | + * @param array $page_templates Array of page templates. Keys are filenames, | |
| 138 | + * checks are translated names. | |
| 139 | + * | |
| 138 | 140 | * @param \WP_Theme $wp_theme |
| 139 | - * @param \WP_Post $post | |
| 141 | + * @param \WP_Post $post | |
| 140 | 142 | * |
| 141 | 143 | * @return array Page templates. |
| 142 | 144 | */ |
| 143 | 145 | public function add_page_templates( $page_templates, $wp_theme, $post ) { |
| @@ -151,11 +153,11 @@ | ||
| 151 | 153 | } |
| 152 | 154 | } |
| 153 | 155 | |
| 154 | 156 | $page_templates = [ |
| 155 | - self::TEMPLATE_CANVAS => esc_html__( 'Elementor Canvas', 'elementor' ), | |
| 156 | - self::TEMPLATE_HEADER_FOOTER => esc_html__( 'Elementor Full Width', 'elementor' ), | |
| 157 | - self::TEMPLATE_THEME => esc_html__( 'Theme', 'elementor' ), | |
| 157 | + self::TEMPLATE_CANVAS => _x( 'Elementor Canvas', 'Page Template', 'elementor' ), | |
| 158 | + self::TEMPLATE_HEADER_FOOTER => _x( 'Elementor Full Width', 'Page Template', 'elementor' ), | |
| 159 | + self::TEMPLATE_THEME => _x( 'Theme', 'Page Template', 'elementor' ), | |
| 158 | 160 | ] + $page_templates; |
| 159 | 161 | |
| 160 | 162 | return $page_templates; |
| 161 | 163 | } |
| @@ -243,12 +245,9 @@ | ||
| 243 | 245 | * |
| 244 | 246 | * @param Document $document The document instance. |
| 245 | 247 | */ |
| 246 | 248 | public function action_register_template_control( $document ) { |
| 247 | - if ( | |
| 248 | - ( $document instanceof PageBase || $document instanceof LibraryPageDocument ) && | |
| 249 | - $document::get_property( 'support_page_layout' ) | |
| 250 | - ) { | |
| 249 | + if ( $document instanceof PageBase || $document instanceof LibraryPageDocument ) { | |
| 251 | 250 | $this->register_template_control( $document ); |
| 252 | 251 | } |
| 253 | 252 | } |
| 254 | 253 | |
| @@ -285,11 +284,9 @@ | ||
| 285 | 284 | |
| 286 | 285 | $document->end_injection(); |
| 287 | 286 | } |
| 288 | 287 | |
| 289 | - /** | |
| 290 | - * The $options variable is an array of $control_options to overwrite the default. | |
| 291 | - */ | |
| 288 | + // The $options variable is an array of $control_options to overwrite the default | |
| 292 | 289 | public function add_template_controls( Document $document, $control_id, $control_options ) { |
| 293 | 290 | // Default Control Options |
| 294 | 291 | $default_control_options = [ |
| 295 | 292 | 'label' => esc_html__( 'Page Layout', 'elementor' ), |
| @@ -402,8 +399,22 @@ | ||
| 402 | 399 | } |
| 403 | 400 | } |
| 404 | 401 | |
| 405 | 402 | return $check; |
| 403 | + } | |
| 404 | + | |
| 405 | + /** | |
| 406 | + * Support `wp_body_open` action, available since WordPress 5.2. | |
| 407 | + * | |
| 408 | + * @since 2.7.0 | |
| 409 | + * @access public | |
| 410 | + */ | |
| 411 | + public static function body_open() { | |
| 412 | + if ( function_exists( 'wp_body_open' ) ) { | |
| 413 | + wp_body_open(); | |
| 414 | + } else { | |
| 415 | + do_action( 'wp_body_open' ); | |
| 416 | + } | |
| 406 | 417 | } |
| 407 | 418 | |
| 408 | 419 | /** |
| 409 | 420 | * Page templates module constructor. |