Skip to content

Instantly share code, notes, and snippets.

View divimode-philipp's full-sized avatar

Philipp Stracker divimode-philipp

View GitHub Profile
@divimode-philipp
divimode-philipp / trigger-after-delay-1.html
Last active September 30, 2022 08:36
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>
@divimode-philipp
divimode-philipp / trigger-after-delay-2.html
Created May 29, 2022 17:40
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);
@divimode-philipp
divimode-philipp / trigger-on-scroll-1.html
Last active September 30, 2022 08:36
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.
@divimode-philipp
divimode-philipp / divi-areas-in-search-results.php
Last active September 30, 2022 08:35
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
*
* ----------
@divimode-philipp
divimode-philipp / dynamic-popups-1.js
Last active September 30, 2022 08:33
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.
*/
@divimode-philipp
divimode-philipp / asset-cache.php
Created September 20, 2022 12:33
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.