is_search example


    if ( is_preview() && get_query_var( 'p' ) && 'publish' === get_post_status( get_query_var( 'p' ) ) ) {
        if ( ! isset( $_GET['preview_id'] )
            || ! isset( $_GET['preview_nonce'] )
            || ! wp_verify_nonce( $_GET['preview_nonce'], 'post_preview_' . (int) $_GET['preview_id'] )
        ) {
            $wp_query->is_preview = false;
        }
    }

    if ( is_admin() || is_search() || is_preview() || is_trackback() || is_favicon()
        || ( $is_IIS && ! iis7_supports_permalinks() )
    ) {
        return;
    }

    if ( ! $requested_url && isset( $_SERVER['HTTP_HOST'] ) ) {
        // Build the URL in the address bar.         $requested_url  = is_ssl() ? 'https://' : 'http://';
        $requested_url .= $_SERVER['HTTP_HOST'];
        $requested_url .= $_SERVER['REQUEST_URI'];
    }

    
<?php get_search_form(); ?> </li> <!-- Author information is disabled per default. Uncomment and fill in your details if you want to use it. <li><h2><?php _e( 'Author' ); ?></h2> <p>A little something about you, the author. Nothing lengthy, just an overview.</p> </li> --> <?php                 if ( is_404() || is_category() || is_day() || is_month() ||
                is_year() || is_search() || is_paged() ) :
                    ?> <li> <?php if ( is_404() ) : /* If this is a 404 page */ ?> <?php elseif ( is_category() ) : /* If this is a category archive */ ?> <p> <?php                     printf(
                        /* translators: %s: Category name. */
                        __( 'You are currently browsing the archives for the %s category.' ),
                        single_cat_title( '', false )
                    );
global $page$paged;

    $title = array(
        'title' => '',
    );

    // If it's a 404 page, use a "Page not found" title.     if ( is_404() ) {
        $title['title'] = __( 'Page not found' );

        // If it's a search, use a dynamic search results title.     } elseif ( is_search() ) {
        /* translators: %s: Search query. */
        $title['title'] = sprintf( __( 'Search Results for &#8220;%s&#8221;' )get_search_query() );

        // If on the front page, use the site title.     } elseif ( is_front_page() ) {
        $title['title'] = get_bloginfo( 'name', 'display' );

        // If on a post type archive, use the post type archive title.     } elseif ( is_post_type_archive() ) {
        $title['title'] = post_type_archive_title( '', false );

        

        do_action( 'atom_comments_ns' );
    ?> > <title type="text"> <?php     if ( is_singular() ) {
        /* translators: Comments feed title. %s: Post title. */
        printf( ent2ncr( __( 'Comments on %s' ) )get_the_title_rss() );
    } elseif ( is_search() ) {
        /* translators: Comments feed title. 1: Site title, 2: Search query. */
        printf( ent2ncr( __( 'Comments for %1$s searching on %2$s' ) )get_bloginfo_rss( 'name' )get_search_query() );
    } else {
        /* translators: Comments feed title. %s: Site title. */
        printf( ent2ncr( __( 'Comments for %s' ) )get_wp_title_rss() );
    }
    ?> </title> <subtitle type="text"><?php bloginfo_rss( 'description' ); ?></subtitle> <updated><?php echo get_feed_build_date( 'Y-m-d\TH:i:s\Z' ); ?></updated>


            // We will 404 for paged queries, as no posts were found.         } elseif ( ! is_paged() ) {
            $author = get_query_var( 'author' );

            // Don't 404 for authors without posts as long as they matched an author on this site.             if ( is_author() && is_numeric( $author ) && $author > 0 && is_user_member_of_blog( $author )
                // Don't 404 for these queries if they matched an object.                 || ( is_tag() || is_category() || is_tax() || is_post_type_archive() ) && get_queried_object()
                // Don't 404 for these queries either.                 || is_home() || is_search() || is_feed()
            ) {
                $set_404 = false;
            }
        }

        if ( $set_404 ) {
            // Guess it's time to 404.             $wp_query->set_404();
            status_header( 404 );
            nocache_headers();
        } else {
            
$classes[] = 'blog';
    }
    if ( is_privacy_policy() ) {
        $classes[] = 'privacy-policy';
    }
    if ( is_archive() ) {
        $classes[] = 'archive';
    }
    if ( is_date() ) {
        $classes[] = 'date';
    }
    if ( is_search() ) {
        $classes[] = 'search';
        $classes[] = $wp_query->posts ? 'search-results' : 'search-no-results';
    }
    if ( is_paged() ) {
        $classes[] = 'paged';
    }
    if ( is_attachment() ) {
        $classes[] = 'attachment';
    }
    if ( is_404() ) {
        $classes[] = 'error404';
    }


?> <section class="no-results not-found"> <header class="page-header alignwide"> <?php if ( is_search() ) : ?> <h1 class="page-title"> <?php                 printf(
                    /* translators: %s: Search term. */
                    esc_html__( 'Results for "%s"', 'twentytwentyone' ),
                    '<span class="page-description search-term">' . esc_html( get_search_query() ) . '</span>'
                );
                ?> </h1>

    do_action( 'rss2_comments_ns' );
    ?> > <channel> <title> <?php     if ( is_singular() ) {
        /* translators: Comments feed title. %s: Post title. */
        printf( ent2ncr( __( 'Comments on: %s' ) )get_the_title_rss() );
    } elseif ( is_search() ) {
        /* translators: Comments feed title. 1: Site title, 2: Search query. */
        printf( ent2ncr( __( 'Comments for %1$s searching on %2$s' ) )get_bloginfo_rss( 'name' )get_search_query() );
    } else {
        /* translators: Comments feed title. %s: Site title. */
        printf( ent2ncr( __( 'Comments for %s' ) )get_wp_title_rss() );
    }
    ?> </title> <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" /> <link><?php ( is_single() ) ? the_permalink_rss() : bloginfo_rss( 'url' ); ?></link> <description><?php bloginfo_rss( 'description' ); ?></description> <lastBuildDate>

function is_search() {
    global $wp_query;

    if ( ! isset( $wp_query ) ) {
        _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
        return false;
    }

    return $wp_query->is_search();
}

/** * Determines whether the query is for an existing single post. * * Works for any post type, except attachments and pages * * If the $post parameter is specified, this function will additionally * check if the query is for one of the Posts specified. * * For more information on this and similar theme functions, check out * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ * Conditional Tags} article in the Theme Developer Handbook. * * @since 1.5.0 * * @see is_page() * @see is_singular() * @global WP_Query $wp_query WordPress Query object. * * @param int|string|int[]|string[] $post Optional. Post ID, title, slug, or array of such * to check against. Default empty. * @return bool Whether the query is for an existing single post. */

function render_block_core_query_title( $attributes ) {
    $type       = isset( $attributes['type'] ) ? $attributes['type'] : null;
    $is_archive = is_archive();
    $is_search  = is_search();
    if ( ! $type ||
        ( 'archive' === $type && ! $is_archive ) ||
        ( 'search' === $type && ! $is_search )
        ) {
        return '';
    }
    $title = '';
    if ( $is_archive ) {
        $show_prefix = isset( $attributes['showPrefix'] ) ? $attributes['showPrefix'] : true;
        if ( ! $show_prefix ) {
            add_filter( 'get_the_archive_title_prefix', '__return_empty_string', 1 );
            

function wp_robots_noindex_search( array $robots ) {
    if ( is_search() ) {
        return wp_robots_no_robots( $robots );
    }

    return $robots;
}

/** * Adds `noindex` to the robots meta tag. * * This directive tells web robots not to index the page content. * * Typical usage is as a {@see 'wp_robots'} callback: * * add_filter( 'wp_robots', 'wp_robots_no_robots' ); * * @since 5.7.0 * * @param array $robots Associative array of robots directives. * @return array Filtered robots directives. */
Home | Imprint | This part of the site doesn't use cookies.