Skip to content

Commit

Permalink
Merge pull request #442 from Codeinwp/bugfix/441
Browse files Browse the repository at this point in the history
Fixed compatibility issue with Elementor
  • Loading branch information
HardeepAsrani authored Sep 17, 2024
2 parents 743dd86 + 1f18d12 commit 82150ae
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Setup PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '7.1'
php-version: '7.2'
extensions: simplexml
tools: composer:v2.1
- name: Checkout source code
Expand Down
15 changes: 15 additions & 0 deletions includes/classes/wp-maintenance-mode.php
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,21 @@ public function add_maintenance_template( $templates ) {
*/
public function use_maintenance_template( $template ) {
global $post;

// Return the default template for Elementor when:
if (
class_exists( '\Elementor\Plugin', false ) &&
(
// Edit Mode is on.
( isset( $_GET['action'] ) && 'elementor' === $_GET['action'] ) || // phpcs:ignore WordPress.Security.NonceVerification.Recommended
// Preview Mode is on.
isset( $_GET['elementor-preview'] ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
)
) {
return $template;
}

// Return the default template if the current post is empty.
if ( empty( $post ) ) {
return $template;
}
Expand Down
6 changes: 4 additions & 2 deletions views/wpmm-page-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
<?php
wp_body_open();

the_post();
the_content();
while ( have_posts() ) {
the_post();
the_content();
}

if ( isset( $settings['bot']['status'] ) && $settings['bot']['status'] === 1 ) {
?>
Expand Down

0 comments on commit 82150ae

Please sign in to comment.