Exclude script or whole plug-in from page caching
-
Hello,
We are using Genesis and Ajax search for a website of ours. And we load the search bar in the mobile version in the header with this function:
function sm_genesis_header_markup_close() { if ( wp_is_mobile() ) { genesis_structural_wrap( 'header', 'close' ); $searchbarmobile = do_shortcode( '[wcas-search-form]'); genesis_markup( array( 'close' => "$searchbarmobile</header>", 'context' => 'site-header', ) ); } else { genesis_structural_wrap( 'header', 'close' ); genesis_markup( array( 'close' => '</header>', 'context' => 'site-header', ) ); } }
Working great the only problem is that we also load this searchbar in the menu for desktop visitor.
The problem is that when somebody visits the mobile version of the site the first time only the mobile search bar is visible but he is making a cache version of this page with the mobile search bar. So when somebody visits the desktop, this cache is loaded en both search bars are visible because he is loading the cache of the mobile version…
How can I exclude the mobile version from the page caching to prevent this issue?
Anybody has an idea? Can I exclude the whole plug-in or can I tweak this function in order for W3 total cache to leave it and not put it in the page cache?
- The topic ‘Exclude script or whole plug-in from page caching’ is closed to new replies.