1

I want to add a banner for some specific keywords that is searched.

For example: http://gold-prediction.com/?s=gold . If someone searched for gold, on side of "Search Results for: gold" I want to add an advertise for one of my products. But if someone is looking for oil, I want to add another advertise.

Does anyone knows how can I do that? I will appreciate. Thanks

4

You need to place the following code in your theme's search.php file.

<?php
$search_query = get_search_query();
if ( $search_query == 'gold' ) {
    echo 'my gold ad';
} else if ( $search_query == 'oil' ) {
    echo 'my oil ad';
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.