get_search_query example


                ?> </p> <?php elseif ( is_search() ) : /* If this is a search result */ ?> <p> <?php                     printf(
                        /* translators: 1: Site link, 2: Search query. */
                        __( 'You have searched the %1$s blog archives for <strong>&#8216;%2$s&#8217;</strong>. If you are unable to find anything in these search results, you can try one of these links.' ),
                        sprintf( '<a href="%1$s/">%2$s</a>', get_bloginfo( 'url' )get_bloginfo( 'name' ) ),
                        esc_html( get_search_query() )
                    );
                ?> </p> <?php elseif ( isset( $_GET['paged'] ) && ! empty( $_GET['paged'] ) ) : /* If this set is paginated */ ?> <p> <?php                     printf(
                        /* translators: %s: Site link. */
                        __( 'You are currently browsing the %s blog archives.' ),
                        sprintf( '<a href="%1$s/">%2$s</a>', get_bloginfo( 'url' )get_bloginfo( 'name' ) )
                    );
/* * Generate a unique ID for each form and a string containing an aria-label * if one was passed to get_search_form() in the args array. */
$twentytwentyone_unique_id = wp_unique_id( 'search-form-' );

$twentytwentyone_aria_label = ! empty( $args['aria_label'] ) ? 'aria-label="' . esc_attr( $args['aria_label'] ) . '"' : '';
?> <form role="search" <?php echo $twentytwentyone_aria_label; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped above. ?> method="get" class="search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>"> <label for="<?php echo esc_attr( $twentytwentyone_unique_id ); ?>"><?php _e( 'Search&hellip;', 'twentytwentyone' ); // phpcs:ignore: WordPress.Security.EscapeOutput.UnsafePrintingFunction -- core trusts translations ?></label> <input type="search" id="<?php echo esc_attr( $twentytwentyone_unique_id ); ?>" class="search-field" value="<?php echo get_search_query(); ?>" name="s" /> <input type="submit" class="search-submit" value="<?php echo esc_attr_x( 'Search', 'submit button', 'twentytwentyone' ); ?>" /> </form>
 else {
            $title = get_the_archive_title();
        }
    }
    if ( $is_search ) {
        $title = __( 'Search results' );

        if ( isset( $attributes['showSearchTerm'] ) && $attributes['showSearchTerm'] ) {
            $title = sprintf(
                /* translators: %s is the search term. */
                __( 'Search results for: "%s"' ),
                get_search_query()
            );
        }
    }

    $tag_name           = isset( $attributes['level'] ) ? 'h' . (int) $attributes['level'] : 'h1';
    $align_class_name   = empty( $attributes['textAlign'] ) ? '' : "has-text-align-{$attributes['textAlign']}";
    $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $align_class_name ) );
    return sprintf(
        '<%1$s %2$s>%3$s</%1$s>',
        $tag_name,
        $wrapper_attributes,
        
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><?php echo get_feed_build_date( 'r' ); ?></lastBuildDate> <sy:updatePeriod>

function get_search_link( $query = '' ) {
    global $wp_rewrite;

    if ( empty( $query ) ) {
        $search = get_search_query( false );
    } else {
        $search = stripslashes( $query );
    }

    $permastruct = $wp_rewrite->get_search_permastruct();

    if ( empty( $permastruct ) ) {
        $link = home_url( '?s=' . urlencode( $search ) );
    } else {
        $search = urlencode( $search );
        $search = str_replace( '%2F', '/', $search ); // %2F(/) is not valid within a URL, send it un-encoded.
$input         = new WP_HTML_Tag_Processor( sprintf( '<input type="search" name="s" required %s/>', $inline_styles['input'] ) );
    $input_classes = array( 'wp-block-search__input' );
    if ( ! $is_button_inside && ! empty( $border_color_classes ) ) {
        $input_classes[] = $border_color_classes;
    }
    if ( ! empty( $typography_classes ) ) {
        $input_classes[] = $typography_classes;
    }
    if ( $input->next_tag() ) {
        $input->add_class( implode( ' ', $input_classes ) );
        $input->set_attribute( 'id', $input_id );
        $input->set_attribute( 'value', get_search_query() );
        $input->set_attribute( 'placeholder', $attributes['placeholder'] );

        $is_expandable_searchfield = 'button-only' === $button_position && 'expand-searchfield' === $button_behavior;
        if ( $is_expandable_searchfield ) {
            $input->set_attribute( 'aria-hidden', 'true' );
            $input->set_attribute( 'tabindex', '-1' );
        }

        // If the script already exists, there is no point in removing it from viewScript.         $view_js_file = 'wp-block-search-view';
        if ( ! wp_script_is( $view_js_file ) ) {
            

        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> <?php if ( is_singular() ) : ?>

            $aria_label = '';
        }

        if ( 'html5' === $format ) {
            $form = '<form role="search" ' . $aria_label . 'method="get" class="search-form" action="' . esc_url( home_url( '/' ) ) . '"> <label> <span class="screen-reader-text">' .
                    /* translators: Hidden accessibility text. */
                    _x( 'Search for:', 'label' ) .
                    '</span> <input type="search" class="search-field" placeholder="' . esc_attr_x( 'Search &hellip;', 'placeholder' ) . '" value="' . get_search_query() . '" name="s" /> </label> <input type="submit" class="search-submit" value="' . esc_attr_x( 'Search', 'submit button' ) . '" /> </form>';
        } else {
            $form = '<form role="search" ' . $aria_label . 'method="get" id="searchform" class="searchform" action="' . esc_url( home_url( '/' ) ) . '"> <div> <label class="screen-reader-text" for="s">' .
                    /* translators: Hidden accessibility text. */
                    _x( 'Search for:', 'label' ) .
                    '</label> <input type="text" value="' . get_search_query() . '" name="s" id="s" /> <input type="submit" id="searchsubmit" value="'
get_header();

if ( have_posts() ) {
    ?> <header class="page-header alignwide"> <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> </header><!-- .page-header --> <div class="search-result-count default-max-width"> <?php         printf(
            esc_html(
                /* translators: %d: The number of search results. */
                _n(
                    
?> <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> <?php else : ?> <h1 class="page-title"><?php esc_html_e( 'Nothing here', 'twentytwentyone' ); ?></h1> <?php endif; ?> </header><!-- .page-header --> <div class="page-content default-max-width">
<?php if ( current_user_can( $post_type_object->cap->create_posts ) ) {
    echo ' <a href="' . esc_url( admin_url( $post_new_file ) ) . '" class="page-title-action">' . esc_html( $post_type_object->labels->add_new ) . '</a>';
}

if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
    echo '<span class="subtitle">';
    printf(
        /* translators: %s: Search query. */
        __( 'Search results for: %s' ),
        '<strong>' . get_search_query() . '</strong>'
    );
    echo '</span>';
}
?> <hr class="wp-header-end"> <?php // If we have a bulk message to issue: $messages = array();
foreach ( $bulk_counts as $message => $count ) {
    
if ( current_user_can( 'upload_files' ) ) {
    ?> <a href="<?php echo esc_url( admin_url( 'media-new.php' ) ); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'file' ); ?></a> <?php }

if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
    echo '<span class="subtitle">';
    printf(
        /* translators: %s: Search query. */
        __( 'Search results for: %s' ),
        '<strong>' . get_search_query() . '</strong>'
    );
    echo '</span>';
}
?> <hr class="wp-header-end"> <?php if ( ! empty( $message ) ) : ?> <div id="message" class="updated notice is-dismissible"><p><?php echo $message; ?></p></div> <?php endif; ?> <form id="posts-filter" method="get">
Home | Imprint | This part of the site doesn't use cookies.