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 // Do not copy this tag. | |
/** | |
* Convert capital letters to lowercase and replace all spaces with an underscore when | |
* new users register for Paid Memberships Pro. | |
* Add this code to your PMPro Customizations Plugin - | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_custom_user_registration_changes( $userdata ) { |
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 // do not include this line | |
/** | |
* Allow non-members to view restricted posts if they are less than 30 days old. | |
* | |
* Add this code to a custom plugin. | |
* | |
* Change the '-30 Days' below if you'd like to allow access for longer or shorter. | |
*/ | |
/** | |
* [open_new_posts_to_non_members description] |
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 | |
/** | |
* By default cancelled members are changed to level 0. This recipe changes that behavior to give them a "cancelled" level that | |
* you have created for that purpose. Can be used to downgrade someone to a free level if they cancel. | |
*/ | |
/** | |
* [pmpro_after_change_membership_level_default_level description] | |
* | |
* @param [type] $level_id [description] | |
* @param [type] $user_id [description] |
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
If you've got local source code you want to add to a new remote new git repository without 'cloning' the remote first, do the following (I often do this - you create your remote empty repository in bitbucket/github, then push up your source) | |
1. Create the remote repository, and get the URL such as git://github.com/youruser/somename.git | |
2. If your local GIT repo is already set up, skips steps 2 and 3 | |
3. Locally, at the root directory of your source, git init | |
4. Locally, add and commit what you want in your initial repo (for everything, | |
git add . |
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 | |
/** | |
* Use PMPro Register Helper to add PMPro Billing Address fields to the edit user page for admins. | |
*/ | |
/** | |
* show_pmpro_address_fields_on_edit_profile Grabs the values from the billing fields which get filled in during checkout and displays on User Profile. | |
* | |
* @return array Array of Register Helper field objects | |
*/ | |
function show_pmpro_address_fields_on_edit_profile() { |
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 | |
/** | |
* Based on the Register Helper example. | |
* We've added a "buddypress" option for each field | |
* set to the XProfile name we used when setting up | |
* the fields in the BuddyPress extended profile. | |
* If the PMPro BuddyPress Add On is activated | |
* then the fields will be synchronized. | |
* Register Helper: https://www.paidmembershipspro.com/add-ons/pmpro-register-helper-add-checkout-and-profile-fields/ | |
* PMPro BuddyPress: https://www.paidmembershipspro.com/add-ons/buddypress-integration/ |
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 | |
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. |