This file contains hidden or 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 // Ignore this first line when copying to your child theme's functions.php file. | |
/** | |
* Dynamically display a WooCommerce product inside a Popup Maker popup. | |
* | |
* Pass in the product ID using the classes attribute for the popup_trigger | |
* shortcode. See usage notes below. | |
*/ | |
function rc_ajax_demo_js() { ?> | |
<script type="text/javascript"> |
This file contains hidden or 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 | |
/** | |
* Close a popup when you submit a Fluent Forms Conversational Form inside that popup. | |
* | |
* Watches for a specific element (".ff_conv_app_4 .text-success") being added to the DOM. | |
* When detected, waits 2 seconds and then closes Popup Maker popup #441 if available. | |
* | |
* @since 1.0.0 | |
* | |
* @return void |
This file contains hidden or 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 | |
/** | |
* PHP to get popup IDs from ACF and render them in a data attribute. | |
* | |
* This code should be placed in your theme's header.php, footer.php, | |
* or a specific template file, usually within the <body> but **before** | |
* the JS code that uses the popup IDs. | |
* | |
* This code example creates a <div> to store the popup IDs just before | |
* the popup's HTML. It does that because the hook's priority is set to 10. |
This file contains hidden or 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
/** | |
* Install custom JS to the footer of your WP posts and pages. | |
* | |
* This SAMPLE code adds a JavaScript function to detect Google Pixel phones. | |
* It uses the WordPress wp_footer action hook to safely inject the script. | |
* | |
* Installation: | |
* 1. Create a child theme if you don't have one | |
* 2. Add this code to your child theme's functions.php file | |
* 3. Or use the Code Snippets plugin for easier management |
This file contains hidden or 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 // Ignore this first line when copying to your child theme's functions.php file. | |
// Test utility | |
add_action('admin_notices', function() { | |
// Only show on popup edit screen after saving. | |
if (!isset($_GET['post']) || get_post_type($_GET['post']) !== 'popup') { | |
return; | |
} | |
// Display the last saved time from a transient. |
This file contains hidden or 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 // Ignore this first line when copying to your child theme's functions.php file. | |
/** | |
* This is an example of how to launch a Popup Maker popup after time on site is more | |
* than 1 minute (regardless of how many pages visited). | |
* | |
* Run this action at 500 priority. | |
* | |
* Change the popupId value to your popup's ID https://wppopupmaker.com/docs/manage-features-or-options/find-the-popup-id/ | |
* |
This file contains hidden or 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 // Ignore this first line when copying to your child theme's functions.php file. | |
/** | |
* Close a popup on a window scroll event. | |
*/ | |
function close_popup_on_scroll() { ?> | |
<script type="text/javascript"> | |
jQuery(document).ready(function ($) { | |
// Set up your constants. |
This file contains hidden or 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 // Ignore this first line when copying to your child theme's functions.php file. | |
/** Try using the ACF shortcode first. */ | |
/** Turn on the ACF shortcode as of ACF 6.3.0. | |
* https://www.advancedcustomfields.com/resources/shortcode/#enabling */ | |
add_action( 'acf/init', 'set_acf_settings' ); | |
function set_acf_settings() { | |
acf_update_setting( 'enable_shortcode', true ); | |
} |
NewerOlder