Title: Allon Sacks's Replies | WordPress.org

---

# Allon Sacks

  [  ](https://wordpress.org/support/users/allonsacksgmailcom/)

 *   [Profile](https://wordpress.org/support/users/allonsacksgmailcom/)
 *   [Topics Started](https://wordpress.org/support/users/allonsacksgmailcom/topics/)
 *   [Replies Created](https://wordpress.org/support/users/allonsacksgmailcom/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/allonsacksgmailcom/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/allonsacksgmailcom/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/allonsacksgmailcom/engagements/)
 *   [Favorites](https://wordpress.org/support/users/allonsacksgmailcom/favorites/)

 Search replies:

## Forum Replies Created

Viewing 15 replies - 1 through 15 (of 20 total)

1 [2](https://wordpress.org/support/users/allonsacksgmailcom/replies/page/2/?output_format=md)
[→](https://wordpress.org/support/users/allonsacksgmailcom/replies/page/2/?output_format=md)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Relevanssi - A Better Search] Exact match](https://wordpress.org/support/topic/exact-match-2/)
 *  Thread Starter [Allon Sacks](https://wordpress.org/support/users/allonsacksgmailcom/)
 * (@allonsacksgmailcom)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/exact-match-2/#post-11189611)
 * Thanks that makes perfect sense.
 * We have no problem updating to premium. What kind of response time can we expect
   once we are premium provided it would probably involve hands on digging into 
   our theme settings and possibly code?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Relevanssi - A Better Search] Exact match](https://wordpress.org/support/topic/exact-match-2/)
 *  Thread Starter [Allon Sacks](https://wordpress.org/support/users/allonsacksgmailcom/)
 * (@allonsacksgmailcom)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/exact-match-2/#post-11172461)
 * Hey,
 * Our pagination is working but the problem is that the results are not what we
   expect.
    Is there any chance we grant you access (it is a blocked site) and you
   have a look?
 * Thanks!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Autoptimize] expiry not working](https://wordpress.org/support/topic/expiry-not-working/)
 *  Thread Starter [Allon Sacks](https://wordpress.org/support/users/allonsacksgmailcom/)
 * (@allonsacksgmailcom)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/expiry-not-working/#post-9425130)
 * Wow thanks for the quick response! And that pointed me in the right direction
   and I fixed it.
    Actually I found in the wp-content/cache folder an htaccess 
   file with the following. I wonder where it came from as after deleting and resaving
   wpsupercache it did not return this bothersome code:
 * # BEGIN supercache
    <IfModule mod_mime.c> <FilesMatch “\.html\.gz$”> ForceType
   text/html FileETag None </FilesMatch> AddEncoding gzip .gz AddType text/html .
   gz </IfModule> <IfModule mod_deflate.c> SetEnvIfNoCase Request_URI \.gz$ no-gzip
   </IfModule> <IfModule mod_headers.c> Header set Vary “Accept-Encoding, Cookie”
   Header set Cache-Control ‘max-age=3, must-revalidate’ </IfModule> <IfModule mod_expires.
   c> ExpiresActive On ExpiresByType text/html A3 </IfModule> Options -Indexes
 * # END supercache
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WooCommerce] How can I add Buy Now and Add to Cart Buttons to my Woocommerce Store](https://wordpress.org/support/topic/how-can-i-add-buy-now-and-add-to-cart-buttons-to-my-woocommerce-store/)
 *  [Allon Sacks](https://wordpress.org/support/users/allonsacksgmailcom/)
 * (@allonsacksgmailcom)
 * [9 years ago](https://wordpress.org/support/topic/how-can-i-add-buy-now-and-add-to-cart-buttons-to-my-woocommerce-store/#post-9188266)
 * After much searching I was surprised this is not something that is standard.
   
   Here was my solution but mind you I did not test it for variations only for a
   normal product plus quantity in the single product page, so it might not work
   for variations though probably the same logic as in the js below would work for
   that:
 * Either use a hook like “woocommerce_single_product_summary”
 * Or copy the wp-content/plugins/woocommerce/templates/single-product/add-to-cart/
   simple.php to your child theme like:
    wp-content/themes/child-theme/woocommerce/
   single-product/add-to-cart/simple.php
 * Edit the file and add the following code where you want the button to appear:
 *     ```
       <div class="express-checkout-wrapper">
                       <a id="dc_express_checkout" href="/checkout/?add-to-cart=<?php echo get_the_ID(); ?>">
                           Purchase
                       </a>
                   </div>
       ```
   
 * Now the only problem is the button will take you to checkout and add the correct
   product but without the correct quantity if you changed it so I used js in my
   custom.js file that is queued in the footer:
 *     ```
       // Add and change quantity to express checkout button when the quantity is updated
           if($('.cart .qty').length){
               var originalUrl = $('#dc_express_checkout').attr('href');
               $('.cart .qty').change(function(){
                   var url = originalUrl + '&quantity=' + $(this).val();
                   $('#dc_express_checkout').attr('href', url);
               });
           }
       ```
   
 * You can change the url from:
 * `href="/checkout/?add-to-cart=<?php echo get_the_ID(); ?>"`
 * to:
 * `href="/cart/?add-to-cart=<?php echo get_the_ID(); ?>"`
 * If you want the button to direct to the cart instead of the checkout page.
    -  This reply was modified 9 years ago by [Allon Sacks](https://wordpress.org/support/users/allonsacksgmailcom/).
    -  This reply was modified 9 years ago by [Allon Sacks](https://wordpress.org/support/users/allonsacksgmailcom/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Relevanssi - A Better Search] Adding weight headings in post content](https://wordpress.org/support/topic/adding-weight-headings-in-post-content/)
 *  Thread Starter [Allon Sacks](https://wordpress.org/support/users/allonsacksgmailcom/)
 * (@allonsacksgmailcom)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/adding-weight-headings-in-post-content/#post-9130387)
 * Thanks!
 * Regarding the second question I got it done already I forgot it has been time
   since I set it up 🙂
 * Regarding the first I appreciate your input.
 * I got it done, seems not to slow things down too much.
    Pasting the code if anyone
   wants it below but first another question.
 * It seems if the text in the h2 is in quotes or with hyphens it gets completely
   overlooked. So in my function below, match does not even return posts where the
   query has quotes or hyphens inside it. Any idea why this is happening or what
   to do about it?
 * Thanks! and here is my code:
 *     ```
       function getTextBetweenTags($string, $tagname) {
       	$pattern = "/<$tagname>(.*?)<\/$tagname>/";
       	preg_match_all($pattern, $string, $matches);
       	return $matches[1];
       }
       add_filter( 'relevanssi_match', 'h2_match' );
       function h2_match($match) {
       	$searchQuery = strtolower(get_search_query());
       	$content_post = get_post($match->doc);
       	$content = strtolower($content_post->post_content);
       	$content = apply_filters('the_content', $content);
       	$content = str_replace(']]>', ']]>', $content);
       	$content2 = getTextBetweenTags($content, 'h2');
       	foreach($content2 as $key=> $value) {
       		if (strpos($value,$searchQuery) !== false) {
       			$match->weight = $match->weight * 30;
       		}
       	}
       	return $match;
       }
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Autoptimize] Schedule cache purge](https://wordpress.org/support/topic/schedule-cache-purge/)
 *  Thread Starter [Allon Sacks](https://wordpress.org/support/users/allonsacksgmailcom/)
 * (@allonsacksgmailcom)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/schedule-cache-purge/#post-8205515)
 * Ok so I tested and the following code works by simple dropping it into the functions.
   php.
    This means that instead of using wp-cron and clearing on set days regardless
   of cache size, the cache this way is cleared when it reaches the size you define.
 *     ```
       $myMaxSize = 350000;
       $statArr=autoptimizeCache::stats();
       $cacheSize=round($statArr[1]/1024);
       if (($cacheSize>$myMaxSize)){
       	autoptimizeCache::clearall();
       }
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Autoptimize] Schedule cache purge](https://wordpress.org/support/topic/schedule-cache-purge/)
 *  Thread Starter [Allon Sacks](https://wordpress.org/support/users/allonsacksgmailcom/)
 * (@allonsacksgmailcom)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/schedule-cache-purge/#post-8201119)
 * Thanks! I will try it out, looks like I actually got the solution while writing
   you the question… I actually started writing the question before I had finished
   and by the time I posted it was kinda I could just test this instead of asking
   but anyway I appreciate your input and this can help others…
 * TTLY agree with you about the canary but some clients are small and do not have
   the budget for me to sort out all the issues to have standardized js and css 
   across the site so emptying the cache every few days is a viable solution. In
   any case I try to use cache preload and changes in the background require the
   cache refresh itself every few days.
 * Are you thinking of adding preload and cache timeout at any point?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Autoptimize] Schedule cache purge](https://wordpress.org/support/topic/schedule-cache-purge/)
 *  Thread Starter [Allon Sacks](https://wordpress.org/support/users/allonsacksgmailcom/)
 * (@allonsacksgmailcom)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/schedule-cache-purge/#post-8199280)
 * Hey, so I have been digging around a bit in the code, I want to clear the cache
   once it reaches a certain size.
    Is there a good way to check I think I have 
   it something like this:
 *     ```
       $myMaxSize = 256000;
       $statArr=autoptimizeCache::stats(); 
       $cacheSize=round($statArr[1]/1024);
       if (($cacheSize>$myMaxSize){
          autoptimizeCache::clearall()
       }
       ```
   
 * Thanks!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Autoptimize] Schedule cache purge](https://wordpress.org/support/topic/schedule-cache-purge/)
 *  Thread Starter [Allon Sacks](https://wordpress.org/support/users/allonsacksgmailcom/)
 * (@allonsacksgmailcom)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/schedule-cache-purge/#post-7711509)
 * Thanks you rock!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Contact Form 7] After update can't choose other languages](https://wordpress.org/support/topic/after-update-cant-choose-other-languages/)
 *  [Allon Sacks](https://wordpress.org/support/users/allonsacksgmailcom/)
 * (@allonsacksgmailcom)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/after-update-cant-choose-other-languages/page/2/#post-7159764)
 * [https://wordpress.org/plugins/contact-form-7/developers/](https://wordpress.org/plugins/contact-form-7/developers/)
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Contact Form 7] After update can't choose other languages](https://wordpress.org/support/topic/after-update-cant-choose-other-languages/)
 *  [Allon Sacks](https://wordpress.org/support/users/allonsacksgmailcom/)
 * (@allonsacksgmailcom)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/after-update-cant-choose-other-languages/page/2/#post-7159762)
 * I went to the svn (debelopers link above) and downloaded the previous version
   and got my hebrew back.
 * Hope this helps people with the same issue who don’t think of this simple solution.
   it did not occur to me until I spent quite a lot of time trying to solve this
   😉
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Contact Form 7] After update can't choose other languages](https://wordpress.org/support/topic/after-update-cant-choose-other-languages/)
 *  [Allon Sacks](https://wordpress.org/support/users/allonsacksgmailcom/)
 * (@allonsacksgmailcom)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/after-update-cant-choose-other-languages/page/2/#post-7159760)
 * Same problem here.
    Using wpml. Even in wpml string translations it shows the
   correct translation but on the site it shows the wrong language i.e in the error
   messages. Always shows in english even when on a page set to a different language.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Contact Form 7] No language options](https://wordpress.org/support/topic/no-language-options/)
 *  Thread Starter [Allon Sacks](https://wordpress.org/support/users/allonsacksgmailcom/)
 * (@allonsacksgmailcom)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/no-language-options/#post-7201303)
 * Thanks. It was translated not long ago.
    All my other site show the translation.
   Not possible to use what exists?
 * Thanks
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Contact Form 7] No language options](https://wordpress.org/support/topic/no-language-options/)
 *  Thread Starter [Allon Sacks](https://wordpress.org/support/users/allonsacksgmailcom/)
 * (@allonsacksgmailcom)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/no-language-options/#post-7201182)
 * Ok, I see you removed the language options but still I should see hebrew error
   messages. I tried changing in the admin to hebrew but it did not help.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Autoptimize] Autooptimizes creates multiple versions of the files on and on](https://wordpress.org/support/topic/autooptimizes-creates-multiple-versions-of-the-files-on-and-on/)
 *  [Allon Sacks](https://wordpress.org/support/users/allonsacksgmailcom/)
 * (@allonsacksgmailcom)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/autooptimizes-creates-multiple-versions-of-the-files-on-and-on/#post-6930013)
 * I grabbed it. Will hope to have a look at the code soon!

Viewing 15 replies - 1 through 15 (of 20 total)

1 [2](https://wordpress.org/support/users/allonsacksgmailcom/replies/page/2/?output_format=md)
[→](https://wordpress.org/support/users/allonsacksgmailcom/replies/page/2/?output_format=md)