Don’t show nothing found message
-
When using elementor custom skin + archive posts widget, isn’t showing the “nothing found” message.
Viewing 5 replies - 1 through 5 (of 5 total)
-
I changed the wp-content/plugins/elementor-pro/modules/posts/skins/skin-base.php render() method from this
public function render() { $this->parent->query_posts(); /** @var \WP_Query $query */ $query = $this->parent->get_query(); if ( ! $query->found_posts ) { return; } $this->render_loop_header(); // It's the global <code>wp_query</code> it self. and the loop was started from the theme. if ( $query->in_the_loop ) { $this->current_permalink = get_permalink(); $this->render_post(); } else { while ( $query->have_posts() ) { $query->the_post(); $this->current_permalink = get_permalink(); $this->render_post(); } } wp_reset_postdata(); $this->render_loop_footer(); }to this
public function render() { $this->parent->query_posts(); /** @var \WP_Query $query */ $query = $this->parent->get_query(); if ( ! $query->found_posts ) { if ( ! $wp_query->found_posts ) { $this->render_loop_header(); $should_escape = apply_filters( 'elementor_pro/theme_builder/archive/escape_nothing_found_message', true ); $message = $this->parent->get_settings_for_display( 'nothing_found_message' ); if ( $should_escape ) { $message = esc_html( $message ); } echo '<div class="elementor-posts-nothing-found">' . $message . '</div>'; $this->render_loop_footer(); return; } } $this->render_loop_header(); // It's the global <code>wp_query</code> it self. and the loop was started from the theme. if ( $query->in_the_loop ) { $this->current_permalink = get_permalink(); $this->render_post(); } else { while ( $query->have_posts() ) { $query->the_post(); $this->current_permalink = get_permalink(); $this->render_post(); } } wp_reset_postdata(); $this->render_loop_footer(); }and now it is working.
Is right to make the changes I made?
If you add the render() method in wp-content/plugins/ele-custom-skin/skins/skin-custom.php it will work too
public function render() { $this->parent->query_posts(); /** @var \WP_Query $query */ $query = $this->parent->get_query(); if ( ! $query->found_posts ) { if ( ! $wp_query->found_posts ) { $this->render_loop_header(); $should_escape = apply_filters( 'elementor_pro/theme_builder/archive/escape_nothing_found_message', true ); $message = $this->parent->get_settings_for_display( 'nothing_found_message' ); if ( $should_escape ) { $message = esc_html( $message ); } echo '<div class="elementor-posts-nothing-found">' . $message . '</div>'; $this->render_loop_footer(); return; } } $this->render_loop_header(); // It's the global <code>wp_query</code> it self. and the loop was started from the theme. if ( $query->in_the_loop ) { $this->current_permalink = get_permalink(); $this->render_post(); } else { while ( $query->have_posts() ) { $query->the_post(); $this->current_permalink = get_permalink(); $this->render_post(); } } wp_reset_postdata(); $this->render_loop_footer(); }Thanks I’ll implement it in the next version.
I need to do more tests with this… I didn’t forgot about it.
If you feel the need to remind me, please do!
Same problem for me ! I feel the need to remind you, so… 😉
Viewing 5 replies - 1 through 5 (of 5 total)
The topic ‘Don’t show nothing found message’ is closed to new replies.