Skip to content

Instantly share code, notes, and snippets.

View danieliser's full-sized avatar

Daniel L. Iser danieliser

View GitHub Profile
<?php
add_action( 'wp_footer', 'my_custom_popup_scripts', 500 );
function my_custom_popup_scripts() { ?>
<script type="text/javascript">
(function ($, document, undefined) {
$('#pum-123')
.on('pumAfterOpen', function () {
@danieliser
danieliser / functions.php
Created March 30, 2017 07:45
Set a cookie and close a popup after Contact Form 7 form is submitted.
<?php
// As is this will check if the form is in a popup, if so set a cookie and close after 5 seconds.
// Copy everything below this line.
function custom_cf7_scripts() { ?>
<script type="text/javascript">
var wpcf7Elm = document.querySelector('.wpcf7');
wpcf7Elm.addEventListener('wpcf7submit', function (event) {
var $form = $(event.target),
<?php
/**
* Moved to https://github.com/danieliser/WP-Product-In-Dash-Review-Requests
*/
<?php
/**
* Moved to https://github.com/danieliser/WP-Product-In-Dash-Review-Requests
*/
@danieliser
danieliser / functions.php
Created December 8, 2016 21:37
Allows customizing redirect url after successful login with Popup Maker AJAX Login Modals. This example checks for a specific class on the trigger which is used to change the redirect.
<?php
/**
* Copy the following to your themes functions.php file and customize as needed.
*
* This example specifically checks for a specific class `type1` on the clicked trigger.
* If present then the hidden field is updated and a different redirect url is sent back.
*
* This example uses the following customizable information.
*
* Field Name: my_custom_field
@danieliser
danieliser / Options.php
Last active October 14, 2016 06:42
Reusable WordPress plugin / theme Option management class. Works well with our Settings managment classes. All options are stored in a single wp_options row.
<?php
/**
* Initialize by calling Options::init( 'your_prefix' );
*
* Get an option Options::get( 'key', 'default' );
* Update an option with Options::update( 'key', 'value' );
*/
if ( ! defined( 'ABSPATH' ) ) {
@danieliser
danieliser / build-shortcode.php
Created October 11, 2016 22:27
Dynamically generate a WordPress shortcode from $tag, $attr & $content.
<?php
function build_shortcode( $tag, $atts = array(), $content = false ) {
$shortcode = '[' . $tag;
if ( ! empty( $atts ) ) {
foreach( $atts as $key => $value ) {
if ( empty( $value ) || ! $value ) {
continue;
@danieliser
danieliser / Loading.php
Created October 6, 2016 02:03
Popup Maker Loading popup scripts
<?php
add_action( 'wp_head', '_custom_head_scripts' );
function _custom_head_scripts() {
// Change this.
$popup_id = 123; ?>
<script type="text/javascript">
(function ($) {
@danieliser
danieliser / scripts.js
Created October 5, 2016 06:01
Trigger a popup if today is Monday through Friday.
(function ($) {
var today = new Date();
$(document).ready(function () {
if (today.getDay() > 0 && today.getDay() < 6) {
$('#pum-123').popmake('open');
}
});
}(jQuery));
@danieliser
danieliser / use-popup-for-edd-terms-link.php
Created August 30, 2016 17:41
Replace the Easy Digital Downloads Show Terms slide down with a Popup Maker popup.