This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function prevent_default_theme_deletion($allcaps, $caps, $args) { | |
$post_id = 123; | |
if ( isset( $args[0] ) && isset( $args[2] ) && $args[2] == $post_id && $args[0] == 'delete_post' ) { | |
$allcaps[ $caps[0] ] = false; | |
} | |
return $allcaps; | |
} | |
add_filter ('user_has_cap', 'prevent_default_theme_deletion', 10, 3); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* ECMA2015 | |
*/ | |
function convertHex(hexCode, opacity = 1){ | |
var hex = hexCode.replace('#', ''); | |
if (hex.length === 3) { | |
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function ($) { | |
var popupID = 123, | |
hiddenFieldSelector = '#nf-field-1'; | |
$(document).on('pumBeforeOpen', '#pum-'+popupID, function () { | |
var trigger = $.fn.popmake.last_open_trigger[0], | |
field = $(hiddenFieldSelector); | |
if (trigger && "" !== trigger.href) { | |
field.val(trigger.href); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_plugin_install_count( $plugin ) { | |
$api = plugins_api( 'plugin_information', array( | |
'slug' => 'popup-maker', | |
'fields' => array( 'active_installs' => true ) | |
) ); | |
if( ! is_wp_error( $api ) ) { | |
return $api->active_installs; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function plugin_install_count_shortcode( $atts ) { | |
$a = shortcode_atts( array( | |
'plugin' => NULL, | |
), $atts ); | |
if( ! $a['plugin'] ) { | |
return; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).on('subscribe.mc4wp','.popmake-content .mc4wp-form', function() { | |
var $popup = PUM.getPopup(this); | |
$popup.trigger('pumSetCookie'); | |
setTimeout(function () { | |
$popup.popmake('close'); | |
}, 5000); // 5 seconds | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This code works to update addon/extension plugin slugs during update from a premapped list. | |
* | |
* Code likely needs to be run in separate plugin/theme/mu-plugin/drop-in. | |
* | |
* Tested Working On: | |
* - Single Site: Updates Page - Singe Plugin. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Conditions are applied to popups based on the current page being viewing. | |
* | |
* Ex. Show Popup if the current page is ____ (AND/OR) ____ | |
* | |
* | |
* All Conditions should return false by default AND only true if 100% matched. | |
* |
NewerOlder