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
//Open external links into new tab | |
<script type="text/javascript"> | |
jQuery('a').filter(function () { | |
return this.hostname != window.location.hostname; | |
}).attr('target', '_blank'); | |
</script> | |
//Adding Fly-in Animations To Any Divi Section, Row and Module | |
//thanks to Gino Quiroz : https://quiroz.co/adding-fly-in-animations-to-any-divi-module/ | |
//Below are the CSS Class groups for each animation. |
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
/** | |
* How to link into the WordPress Customizer | |
*/ | |
Simple Link: | |
<a href="<?php echo esc_url( admin_url( 'customize.php' ) ); ?>">Link to Customizer</a> | |
Link to Panel: | |
$query['autofocus[panel]'] = 'nav_menus'; |
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 | |
//phpDoc for new PMPro function | |
/** | |
* A description of what the function does. | |
* | |
* @param {array, string, int, objext} {$variable_name} {Short description} | |
* @return {array, string, int, mixed, object} {$variable_name} {Short description} | |
* | |
* {@internal Any To-Dos etc.} | |
* |
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 | |
/** | |
* Notification bar when post views are being tracked and restricted by the Limit Post Views Add On | |
*/ | |
function a_notification_bar_for_limit_post_view() { | |
// Check for past views. Needs to check if the post is locked at all by default. | |
if ( isset( $_COOKIE['pmpro_lpv_count'] ) ) { | |
global $current_user; | |
// Check cookie for views value. |
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 | |
/** | |
* customize_pmpro_login_redirect_url Creates conditions for each level to have its own confirmation URL | |
* | |
* @param [type] $return_url Different URL for each level | |
* @param [type] $request URL the user is coming from, ie login url. | |
* @param [type] $user user data | |
* @return [type] The URL of the level for user logging in | |
*/ | |
function customize_pmpro_login_redirect_url( $return_url, $request, $user ) { |
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 | |
session_start(); | |
/** | |
* Test if PHP Session Variables are working. | |
* Step 1: Add this code into a custom plugin or in a PHP file you know is being executed. | |
* Step 2: Navigate to /?test=123. You should see a blank old value and 123 as the new value. | |
* Step 3: Navigate to /?test=456. You should see 123 as the old value and 456 as the new value. | |
* If you see a blank old value again, that means that session variables are not enabled or otherwise broken. | |
* If the timestamp at the top is not being updated, the page may be cached. | |
* Step 4: Remove this code. |
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 | |
/** | |
* pmpro_hide_acf_fields This code will filter ACF fields added to custom templates using the post's membership requirements. | |
* | |
* Add this code to your PMPro Customizations Plugin | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
* | |
* https://www.advancedcustomfields.com/resources/acf-format_value/ | |
* | |
* @param mixed $value Value which was loaded from the database |
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 | |
/** | |
* Redirect user based on user role after successful login. | |
* | |
* $pmpro_pages returns an array: | |
* * $pmpro_pages['account'] | |
* * $pmpro_pages['billing'] | |
* * $pmpro_pages['cancel'] | |
* * $pmpro_pages['checkout'] | |
* * $pmpro_pages['confirmation'] |
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 | |
/** | |
* Create a custom shortcode to show membership account information | |
* | |
* Add this code to your PMPro Customizations Plugin - For more info on this visit: | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function pmpro_shortcode_account_customized( $atts, $content = null, $code = '' ) { | |
global $wpdb, $pmpro_msg, $pmpro_msgt, $pmpro_levels, $current_user, $levels; |
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 | |
/** | |
* Place this code in your Customizations plugin, not including the opening php tag on line 1. | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
/** | |
* Create a menu to give us a place to perform the reset. I'm choosing a Dashboard menu purely for ease of access. | |
*/ | |
add_action( 'admin_menu', 'core_reset_views_admin_page' ); | |
function core_reset_views_admin_page() { |