Skip to content

Instantly share code, notes, and snippets.

@mgibbs189
Last active September 29, 2015 13:39
Show Gist options
  • Select an option

  • Save mgibbs189/5ae56afdebfb59c6897b to your computer and use it in GitHub Desktop.

Select an option

Save mgibbs189/5ae56afdebfb59c6897b to your computer and use it in GitHub Desktop.
FacetWP - store post IDs into a cookie
<script>
(function($) {
$(document).on('facetwp-loaded', function() {
var cookie_data = JSON.stringify(FWP.settings.post_ids);
setCookie("fwp_posts", cookie_data, 7);
});
})(jQuery);
function setCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires = "expires="+d.toUTCString();
document.cookie = cname + "=" + cvalue + "; " + expires;
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment