Site logo

Archived topic

"Nothing was found."

3 replies · Started by David on July 27, 2022

Viewing posts 1–4 of 4

Hello,

I am having problems with the "Nothing was found." message as soon as I use Elements as content template. Instead of correctly displaying the message "Nothing was found." in case of an incorrect search, HTML elements from my content-template are being shown.

The correct variant (without Elements)
http://vertriebsrecht.de.dedi4088.your-server.de/urteilsbesprechungen/?_suche_besprechungen=xxxxxxxx

The incorrect variant (with Elements)
http://vertriebsrecht.de.dedi4088.your-server.de/rechtsprechungen/?_suche_rechtsprechungen=xxxxxxxx

I want that no "Elements" elements are displayed in case of an unsuccessful search.

Hi David,

Try this php snippet, replace 2560with your content template element ID.

add_filter( 'generate_element_display', function( $display, $element_id ) {

    global $post;

    if ( 2560 === $element_id && is_post_type_archive() && !$post ) {

        $display = false;

    }

    return $display;

}, 10, 2 );

That helped. Thanks a lot!

You are welcome :)

This archived topic is closed to new replies.