Skip to content

Instantly share code, notes, and snippets.

View stracker-phil's full-sized avatar

Philipp Stracker stracker-phil

View GitHub Profile
@stracker-phil
stracker-phil / trigger-after-delay-1.html
Created September 30, 2022 08:36 — forked from divimode-philipp/trigger-after-delay-1.html
Sample trigger for Popups for Divi / Divi Areas Pro that opens the #contact Popup after 5 seconds
<script>
setTimeout(function () {
DiviArea.show('contact');
}, 5000);
</script>
@stracker-phil
stracker-phil / trigger-after-delay-2.html
Created September 30, 2022 08:36 — forked from divimode-philipp/trigger-after-delay-2.html
Generic trigger snippet for Popups for Divi / Divi Areas Pro to trigger the given Popup after a delay.
<script>
(function () {
// TODO: Adjust the following two lines:
var popup = 'contact'; // Your Popup ID.
var delay = 5; // Delay [in seconds].
setTimeout(function () {
DiviArea.show(popup);
}, delay * 1000);
@stracker-phil
stracker-phil / trigger-on-scroll-1.html
Created September 30, 2022 08:36 — forked from divimode-philipp/trigger-on-scroll-1.html
JS snippet for Popups for Divi / Divi Areas Pro to trigger a Popup after the user scrolled down to a certain point
<script>
(function ($) {
// TODO: Adjust the following to lines to your needs:
var popup = 'contact'; // Your Popup ID.
var distance = 500; // Scroll distance [pixel].
$(window).on('scroll.popup_' + popup, function () {
// Check if the user scrolled far enough.
@stracker-phil
stracker-phil / divi-areas-in-search-results.php
Created September 30, 2022 08:35 — forked from divimode-philipp/divi-areas-in-search-results.php
Include Divi Areas in WordPress search results
<?php
/**
* How to use this snippet:
*
* 1. Click the "Download ZIP" button (top-right area)
* 2. Open wp-admin > Plugins > Add New
* 3. Click "Upload Plugin" and select the zip file
* 4. After uploading the zip file, activate the plugin
*
* ----------
@stracker-phil
stracker-phil / dynamic-popups-1.js
Created September 30, 2022 08:33 — forked from divimode-philipp/dynamic-popups-1.js
Two ways how to display dynamic contents inside a Divi Area. In this sample we only change the URL of an iframe inside the Area, but it's possible to literally change anything inside the Area (e.g. fill out form fields, insert a user-name into a <span>, show/hide a button, etc.)
/**
* Option 1:
* Open an existing Popup and change the URL of an iframe inside the Popup.
*
* Preparation:
* Create a Divi Area (or an On-Page Popup) which contains an iframe.
*
* @param {string} areaId - The ID of an existing Popup or Divi Area.
* @param {string} iframeUrl - The new URL of the iframe inside the Popup.
*/
@stracker-phil
stracker-phil / asset-cache.php
Created September 30, 2022 08:33 — forked from divimode-philipp/asset-cache.php
Proof of concept - Cache External WP Assets
<?php
/**
* Proof of concept for https://github.com/divimode/gdpr-cache-script-styles
*/
/**
* Filter all scripts and style URLs.
* When an external URL is detected, download the file
* and replace it in the page source.