• Resolved precies

    (@precies)


    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?

    • This topic was modified 4 years, 8 months ago by precies.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @precies

    Thank you for your inquiry and I am happy to assist you with this.

    There are a couple of things that you can try.
    The first is to use User Agent Groups in Performance>User Agent Groups. This option allows you to create a group of user agents by specifying names in the user agents field. Assign a set of user agents to use a specific theme, redirect them to another domain, or if an existing mobile plugin is active, create user agent groups to ensure that a unique cache is created for each user agent group. Drag and drop groups into order (if needed) to determine their priority (top -> down).
    The second thing that you can do is to use Page Fragment Caching. This allows you to wrap the PHP code with mfunc and create the Page Fragment Cache exception.
    The last thing that you can do is to enable the Genesis and Fragment Cache extensions (Both available after Upgrade). This will ensure the dynamic caching for the genesis theme once Fragment Cache is enabled.
    Thank you!

    Thread Starter precies

    (@precies)

    Hello Marko,

    Thanks for the fast response and the clear answers! I managed to fix my issue with the first option: User Agent Groups.

    Problem is fixed now!:)

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @precies

    You are most welcome!

    We would really appreciate it if you could take a minute and post a review?here. This will help us to continue offering a top-notch product to users.
    Thanks!

    Thread Starter precies

    (@precies)

    Done:)

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Exclude script or whole plug-in from page caching’ is closed to new replies.