<!-- wp:preformatted -->
<pre class="wp-block-preformatted">&lt;script>
(function($){
    $(document).ready(function(e){
      var url = new URL(location.href);
      var params = new URLSearchParams(url.search);
      var yx = params.get('sort_by');
      var dest1 = null,dest2 = null;
      if ( yx != null ) {  
          //alert(yx);
          var tops = yx.split(',');
         if ( tops.length > 1 ) {
           dest1 = tops[0];
           dest2 = tops[1];
         } else {
           dest1 = tops[0];
         }
      }

      var edest1 = edest2 = null;
      $('ul.grid--view-items li').each(function(e){
        var link_url = $(this).find('a.grid-view-item__link').attr('href');
        if ( dest1 != null &amp;&amp; link_url.indexOf(dest1) != -1 ) {
          edest1 = $(this);
        } else if ( dest2 != null &amp;&amp; link_url.indexOf(dest2) != -1 ) {
          edest2 = $(this);
        }
      });  

      if ( edest2 != null ) {
        $('ul.grid--view-items').prepend(edest2);
      }
      if ( edest1 != null ) {
        $('ul.grid--view-items').prepend(edest1);
      }

      edest2 = null;

      


});
})(jQuery);

  &lt;/script></pre>
<!-- /wp:preformatted -->