Skip to content

Instantly share code, notes, and snippets.

View flymke's full-sized avatar

Michael Schönrock flymke

View GitHub Profile
@flymke
flymke / functions.php
Created November 29, 2021 11:18
Add 'opened' class to all doors that were previously clicked by the user - SantaPress
add_action( 'wp_head', function () { ?>
<script>
jQuery(document).ready(function($){
// click on door and save open status to local storage
$('.santapress-door.status-publish:not(.preview)').click(function() {
var postid = $(this).data('postid');
var opendoors = JSON.parse( window.localStorage.getItem('opendoors') );
if(!opendoors) {
var opendoors = [];
@flymke
flymke / functions.php
Created November 30, 2021 15:35
make future doors clickable, e.g. for custom popups
add_action( 'wp_head', function () { ?>
<script>
jQuery(document).ready(function($){
$('.santapress-door.status-future:not(.preview)').css('pointer-events', 'auto').find('a').removeClass('santapress-modal');
});
</script>
<?php } );
@flymke
flymke / iframe.html
Last active August 9, 2022 20:57
Booklyn iFrame Intergration
<div class="iframe-holder">
<iframe id="booklynFrame" src="https://<IHRE_SUBDOMAIN>.booklyn.io/embed" width="100%" height="100" scrolling="no" style="border:0"></iframe>
<script src="https://booklyn.io/js/iframeResizer.min.js"></script>
<script>
iFrameResize({ log: false, heightCalculationMethod: 'lowestElement' }, '#booklynFrame');
</script>
</div>
@flymke
flymke / custom.css
Created November 17, 2022 08:55
SantaPress - Change Background, Fonts in Modal through CSS
// Change Background
.santapress-post.modal {
background:red !important; border:0 !important
}
// Change Font for <h1> Title
.santapress-post.modal h1.santapress-title {
font-family: arial, sans-serif !important;
}
@flymke
flymke / custom.js
Created November 21, 2023 23:13
santapress open modal by url param
jQuery(document).ready(function( $ ){
$(window).load(function() {
var searchParams = new URLSearchParams(window.location.search);
if(searchParams.has('sp_door_post')) {
var sp_door_post = searchParams.get('sp_door_post');
var $door = $('.santapress-container').find('[data-postid='+sp_door_post+'] a.santapress-modal');
$door.click();
}
});
});