SimplyRETS / simplyretswp

SimplyRETS Wordpress Plugin - Show your MLS listings on your website...simply.
http://wordpress-demo.simplyrets.com
GNU General Public License v3.0
21 stars 20 forks source link

Add fix for Avada Layout Builder duplicate content #266

Open CodyReichert opened 6 months ago

CodyReichert commented 6 months ago

The Avada theme has a bug in their Layout Builder where the_content is generated for the header, body, and footer. This causes duplicate content on our listing details pages.

This should fix the issue. We should find a way to add this to our plugin so users don't have to add it themselves.

  1. Go to the Appearance->Theme File Editor page in your WordPress dashboard
  2. Make sure Select theme to edit is Avada Child
  3. In the functions.php file, paste the following code (below any existing code is fine):
add_action('awb_remove_third_party_the_content_changes', 'sr_avada_remove_filters', 10);

function sr_avada_remove_filters() {
    if (class_exists('SimplyRetsCustomPostPages' )) {
        remove_filter('the_content', array('SimplyRetsCustomPostPages', 'srPostDefaultContent'));
    }
}

add_action('awb_readd_third_party_the_content_changes', 'sr_avada_readd_filters', 20);

function sr_avada_readd_filters() {
    if (class_exists( 'SimplyRetsCustomPostPages' )) {
        add_filter('the_content', array('SimplyRetsCustomPostPages', 'srPostDefaultContent'));
    }
}