Title: [Plugin: WP Super Cache] How to Dynamically Load This Script
Last modified: August 20, 2016

---

# [Plugin: WP Super Cache] How to Dynamically Load This Script

 *  [btks](https://wordpress.org/support/users/btks/)
 * (@btks)
 * [15 years ago](https://wordpress.org/support/topic/plugin-wp-super-cache-how-to-dynamically-load-this-script/)
 * Hi There,
 * I am totally confused on how to dynamically load the following PHP Script:
 * First, you have this code which has been placed into functions.php:
 *     ```
       $ref = $_SERVER['HTTP_REFERER'];
       $SE = array('/search?', 'images.google.', 'google.', 'bing.', 'web.info.com', 'search.', 'del.icio.us/search', 'soso.com', '/search/', '.yahoo.');
       foreach ($SE as $source) {
         if (strpos($ref,$source)!==false) {
           setcookie("sevisitor", 1, time()+3600, "/", ".clubpenguincheatz.com");
           $sevisitor=true;
         }
       }
   
       function wpbeginner_from_searchengine(){
         global $sevisitor;
         if ($sevisitor==true || $_COOKIE["sevisitor"]==1) {
           return true;
         }
         return false;
       }
       ```
   
 * Then, you insert this code where you’d like to display advertisements to search
   engine visitors:
 *     ```
       <?php if (function_exists('wpbeginner_from_searchengine')) {
         if (wpbeginner_from_searchengine()) { ?>
       GOOGLE ADVERTISEMENT HERE
       <?php } } ?>
       ```
   
 * The Problem? I have WP Super Cache and have tried to follow Donncha’s Guide on
   how to load dynamic content, but once I do something like:
 *     ```
       <!--mclude file.php-->
       <?php include_once( ABSPATH . 'file.php' ); ?>
       <!--/mclude-->
       ```
   
 * Which includes the codes above, everything on my website stops working except
   everything above this line.
 * What’s the best approach to do what I am needing to do?
 * My Goal: Show Google Ads based on whether or not you’re a Search Engine Visitor
   WITH WP Super Cache.
 * Thank You.

Viewing 1 replies (of 1 total)

 *  Thread Starter [btks](https://wordpress.org/support/users/btks/)
 * (@btks)
 * [14 years, 12 months ago](https://wordpress.org/support/topic/plugin-wp-super-cache-how-to-dynamically-load-this-script/#post-2085652)
 * Hello? Can anyone please assist me. Thanks

Viewing 1 replies (of 1 total)

The topic ‘[Plugin: WP Super Cache] How to Dynamically Load This Script’ is closed
to new replies.

 * 1 reply
 * 1 participant
 * Last reply from: [btks](https://wordpress.org/support/users/btks/)
 * Last activity: [14 years, 12 months ago](https://wordpress.org/support/topic/plugin-wp-super-cache-how-to-dynamically-load-this-script/#post-2085652)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
