Check if page built with Elementor without checking meta (ok)
https://github.com/elementor/elementor/issues/6257
How to detect page/post was built by Elementor?
https://github.com/elementor/elementor/issues/3212
if ( Elementor\Plugin::instance()->db->is_built_with_elementor( $post_id ) ) {
//page is build with elementor
}
// or by checking directly
$elementor_page = get_post_meta( $post_id, '_elementor_edit_mode', true );
if ( ! ! $elementor_page ) {
//page is build with elementor
}
Hoặc đọc thêm cách dưới đây.
<?php
// Check if the page built with Elementor
$elementor_page = get_post_meta( get_the_ID(), '_elementor_edit_mode', true );
if ( (bool)$elementor_page ) : ?>
<div class="main-content">
<?php the_content(); ?>
</div>
<?php else : ?>
<section class="section-wrap pb-40">
<div class="container">
<?php the_content(); ?>
</div>
</section>
<?php endif; ?>
PreviousDifference Between is_singular > is_single, is_singular = is_single + is_page + is_attachmen (ok)Next[ERROR] wp-scripts is not recognized (ok)
Last updated
Was this helpful?