Forums

display automatic google adsense for search if no results on wordpress search (2 posts)

  1. bernard1980
    Member
    Posted 1 year ago #

    hi,
    Because i don't want to put several searchboxes on my site i would like to have a special feature.

    now the search.php file works as follow.
    if results --> show different results
    if no results --> display message = sorry, their are no results for ' '

    what i would like to obtain

    if no results --> show automatically results of google adsense for search ( with idcode )

  2. kulpreetsingh
    Member
    Posted 1 year ago #

    You could try editing your search.php page to include your Adsense code, and output the search fields (e.g. "We couldn't find information on X on the website. Please try the related links below:"). The Adsense will try to relate ads to the words on the page. If the search keywords entered show up before the Adsense, this might work.

    The way to output the search fields is: <?php echo $s; ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.