Plugin Directory

Changeset 2205904


Ignore:
Timestamp:
12/04/2019 01:27:19 PM (6 years ago)
Author:
rxnlabs
Message:

Fixed bug where popups would not work with the Elementor pagebuilder plugin

Popups would show the page's content instead of showing the popup content on Elementor enabled pages. This would cause the popup to look really weird trying to load Elementor's HTML inside of the popup

Location:
wp-pop-up/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • wp-pop-up/trunk/classes/class-wp-popup.php

    r2124870 r2205904  
    2020class WP_Popup {
    2121
    22 
    2322    /**
    2423     * Configuration object for the current popup
     
    155154
    156155        add_action( 'wp_footer', array( $this, 'footer' ) );
     156        add_action( 'elementor/frontend/the_content', array( $this, 'elementor_footer' ) );
    157157        add_action( 'wp_enqueue_scripts', array( $this, 'assets' ) );
    158158        add_action( 'admin_notices', array( $this, 'multiple_instances_admin_notice' ) );
     
    555555
    556556    /**
     557     * Make the popup work with Elementor.
     558     *
     559     * Disable Elementor's HTML markup that gets applied when using the_content filter and having this popup appear on Elementor enabled pages.
     560     *
     561     * @param string $elementor_content Elementor's default markup along with the post content from our popup itself.
     562     *
     563     * @return string WP Popup content without Elementor markup or Elementor marked up page.
     564     */
     565    public function elementor_footer( $elementor_content ) {
     566        // Don't do anything if there's no overlay on this page.
     567        if ( ! $this->config->current_id ) {
     568            return $elementor_content;
     569        }
     570
     571        // Variables for the modal template
     572        $content  = apply_filters( 'the_content', get_post_field( 'post_content', $this->config->current_id ) );
     573        // Load the modal markup
     574        ob_start();
     575        include_once dirname( __DIR__ ) . '/templates/popup.php';
     576        $content = ob_get_contents();
     577
     578        if ( ! empty( $content ) ) {
     579            return $content;
     580        }
     581
     582        return $elementor_content;
     583    }
     584
     585    /**
    557586     * Loop through the possible CSS Rules to check if there's post_meta for it
    558587     */
  • wp-pop-up/trunk/readme.txt

    r2191054 r2205904  
    7070== Changelog ==
    7171
     72= 1.1.4 =
     73* Fix bug where popups would not work on Elementor pages. The popups would show the post content (including Elementor styles) in the popup instead of showing the popup's content.
     74
    7275= 1.1.3 =
    7376* Fix minor styling issue with spinning loading gif in the admin.
  • wp-pop-up/trunk/wp-popup.php

    r2124871 r2205904  
    33Plugin Name: WP Pop-up
    44Description: Show a highly-configurable popup for your pages to encourage donations, actions. etc.
    5 Version: 1.1.3
     5Version: 1.1.4
    66Author: Cornershop Creative
    77Author URI: https://cornershopcreative.com
     
    1414}
    1515
    16 define( 'WP_POPUP_VERSION', '1.1.3' );
     16$wp_popup_plugin_data = get_plugin_data( __FILE__, true );
     17define( 'WP_POPUP_VERSION', $wp_popup_plugin_data['Version'] );
     18// remove from global so we don't pollute global
     19unset( $wp_popup_plugin_data );
    1720
    1821require_once dirname( __FILE__ ) . '/classes/class-wp-popup.php';
Note: See TracChangeset for help on using the changeset viewer.