admin管理员组

文章数量:1122832

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

For example: /?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

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

Share Improve this question asked Jun 7, 2015 at 12:14 juanorajuanora 1112 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 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';
}

本文标签: Edit search results in order to advertise