WordPress

Migrating from Elementor to Custom Themes

At hello, we handle various tasks, including optimizing websites that heavily utilized Elementor. We've encountered numerous clients seeking a complete redesign of their site—ranging from homepages to article pages. Often, these sites suffer from performance issues, as indicated by low Lighthouse scores. Our recommended solution involves transitioning from Elementor to custom themes, which we tailor specifically for each client.

Why a Custom Theme?

Opting for a custom theme improves site speed, reduces extraneous code, and enhances SEO. Additionally, it preserves the ability to customize via ACF custom fields from the WordPress admin panel, providing flexibility without the bloat.

Challenges We've Faced

In transitioning away from Elementor, several unique challenges arise:

These are just two common problems that we’ve faced, but the more websites we encounter, the more problems we find. It seems like there’s no choice; we can't just disable Elementor and lose important business logic.

Our Proven Solution

While the website will look mostly good after disabling the "theme builder" templates for their respective parts, closer inspection will reveal problems. For example, the homepage will seamlessly align with our custom theme once we disable the Elementor homepage template, but we still might have unwanted code loaded for the homepage, even though it doesn’t use Elementor.

While each site has its own specific needs, we've devised a versatile solution that fits most cases. We selectively disable Elementor on most pages while keeping it active on others, such as specific landing pages and older blog posts.

Here's how we implement this strategy:

function disable_elementor_on_certain_pages() {
    global $post;

    // Pages where Elementor should remain active
    $allowed_pages = ['lp-1', 'lp-2'];
    
    // Check if the current page is in the allowed list or accessed via admin panel
    if (is_page($allowed_pages) || is_admin()) {
        return;
    }

    // Check if the current post is a post and older than the cutoff date
    if ($post && $post->post_type === 'post') {
        $post_date = new DateTime($post->post_date);
        $cutoff_date = new DateTime('2024-06-02');
        if ($post_date < $cutoff_date) {
            return;
        }
    }

    // Deregister Elementor styles and scripts on pages where it's not needed
    wp_deregister_style('elementor-frontend');
    wp_deregister_script('elementor-frontend');
}

add_action('wp_enqueue_scripts', 'disable_elementor_on_certain_pages', 20);

This approach ensures that we maintain the functionality of essential business components while enhancing overall site performance by eliminating unnecessary Elementor assets where they are no longer needed.

Enhance Your Website with Us

At hello, we draw from a rich vein of experience to deliver robust, SEO-friendly, and tailored web solutions. If you're aiming to enhance your digital footprint, we’re ready to elevate your site's performance and user experience. Let’s connect and transform your website into a sleek, efficient, and engaging platform.


לשיחת ייעוץ חינם

איפיון
פיתוח
תחזוקה
SEO
שירות כולל
אחר