WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] integrating $_GET into search.php (3 posts)

  1. heiseheise
    Member
    Posted 6 years ago #

    One year user, first time poster :)

    Anyway, so I'm building my first template and want to include the simple ability for the search engine to return the original query to the searcher, instead of just "Not Found" which is the default.

    So, I have this thus far:


    <div class="post">
    <h2><?php _e('I\'m sorry, the query '$_GET["s"];' could not be found'); ?></h2>
    </div>

    I used "s" as the name because it looks like that's what it is named in searchform.php - but yet, when I try testing it out, I get a: Parse error: syntax error, unexpected T_VARIABLE

    Can anyone let me know what little thing I'm missing? :) thanks!

  2. wp_guy
    Member
    Posted 6 years ago #

    It should be:

    <?php _e('I\'m sorry, the query '.$_GET["s"].' could not be found'); ?>

    And I don't think the _e function will work like that, but if your site is in english, then it shouldn't matter.

  3. heiseheise
    Member
    Posted 6 years ago #

    Ah concatenation, I figured it was you I was missing. I had already tried putting them outside the single quotes but I guess I forgot inside. :) Thank you - it worked fine!

Topic Closed

This topic has been closed to new replies.

About this Topic