• Hey, we are using an own theme, where we have the the_content() function in an if clause.

    This causes error on the Elementor builder. How can we avoid this error?Reason is, that we load content from different sources in the theme. But for elementor we check if elementor is loaded and then we fire the the_content() function.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi

    Can you please send me a link to your site?

    Thread Starter wp_user1

    (@wp_user1)

    The Site is not live yet and you cannot see much in the frontend. Everything is working fine in frontend..

    So we tried this way: checking if Elementor editor is active or not like that:

    function m5_backend_active() {
    if( \Elementor\Plugin::$instance->editor->is_edit_mode()
    ||
    \Elementor\Plugin::$instance->preview->is_preview_mode()
    )
    {
    return true;
    } else {
    return false;
    }
    }

    if this returns a true we start the the_content() function in theme file (it’s only the index.php so for all pages the same).

    Then we get the typical Elementor error (“no the_content() found” blabla) and after some waiting with the safe mode it works.. but we cannot tell this to the users.. always waiting until they can use the safe mode.. and I would like to fix it.

    I then tried with “goto” in code, but this does not work as well. It looks like that:

    $m5_backend_active=m5_backend_active();
    if(!$m5_backend_active) goto m5;
    the_content(); // nur für Elementor aufrufen
    if($m5_backend_active) goto elementor;
    m5:
    // normal website..
    elementor:
    // footer and end

    • This reply was modified 1 year, 6 months ago by wp_user1.
    Thread Starter wp_user1

    (@wp_user1)

    @israelaz – do you understand the point?

    • This reply was modified 1 year, 6 months ago by wp_user1.

    Hi

    Please note that through this channel, we can only provide support for Elementor’s existing features and do not provide support for custom code solutions, as it goes out of our?support scope.
    Currently, development/custom code queries (custom widgets and functions, Theme Child, custom code and CSS, BETA testing issues, compatibility issues, etc.) have to be directed to our?GitHub project, where our developers will be able to assist. Kindly note that our GitHub project is not a support channel; therefore, the response times may vary. We appreciate your understanding.
    To post on our GitHub Repository, follow this guide:?Contribution Guidelines.

    Thread Starter wp_user1

    (@wp_user1)

    Hm I think This is a quite basic question.. but thanks nevertheless.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘the_content in if-clause not working’ is closed to new replies.