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: | |
| // https://www.wpbeginner.com/wp-tutorials/how-to-add-custom-post-status-for-blog-posts-in-wordpress/ | |
| // https://rudrastyh.com/wordpress/custom-post-status-quick-edit.html | |
| class BP_Custom_Post_Status { | |
| public $post_types = array( 'videographer', 'photographer' ); | |
| public function __construct() { |
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 | |
| function log_gettext_string( $text ) { | |
| global $mylist; | |
| if ( !isset($mylist) ) { | |
| $mylist = array(); | |
| register_shutdown_function(function($a = null) { global $mylist; echo implode('<br>', $mylist); exit; } ); | |
| } | |
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 | |
| // Both of these work | |
| // @hook do_action( 'gform_stripe_fulfillment', $session, $entry, $feed, $form ); | |
| function bpc_debug_stripe( $session, $entry, $feed, $form ) { | |
| error_log( 'Payment received for STRIPE' ); | |
| } | |
| add_action( 'gform_stripe_fulfillment', 'bpc_debug_stripe', 20, 4 ); | |
| // @hook do_action( 'gform_paypal_fulfillment', $entry, $feed, $transaction_id, $amount ) |
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 | |
| /* | |
| * A+A Error Reporter | |
| * Created by [email protected] | |
| */ | |
| if ( !isset($error) || !isset($handled) ) { | |
| echo 'Error: Unhandled exception occurred and required parameters $error and $handled were not supplied in '. __FILE__ .':'. __LINE__; | |
| exit; | |
| } |
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
| problem: | |
| "npm i" fails with an error that Python failed to compile something like "%s.%s.%s" | |
| solution 1: | |
| revert python 3.8.5 to 2.7.13 to fix a compiler error | |
| solution 2: | |
| to install python and VC Redist automatically run: | |
| npm install --global windows-build-tools |
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 | |
| /** | |
| * Triggers an action after the "acf/save_post" action, priority 1000. | |
| * If hooks are not called, they will be called at the end of the PHP thread | |
| * | |
| * Specify your callback as the first argument, and any arguments to pass to it as the second argument. | |
| * | |
| * @param callable Callback | |
| * @param post_id The ACF-formatted post id you want to hook into |
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 | |
| // How to use: | |
| // 1. Copy the class at the end of the file into your code. | |
| // 2. Follow the examples below for usage. | |
| // ----------------------- | |
| // Example #1: Basic usage | |
| // Start |
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
| --[[ | |
| Microcontroller Name: Rate of Change | |
| Description: Take an input value and outputs the rate of change per second. | |
| Inputs: | |
| 1) Value (number, required): Input number (eg, fuel tank capacity) | |
| 2) Refresh Rate (number, optional, default 60): Game ticks between each update | |
| Outputs: | |
| 1) Number: Change since last update |
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 | |
| // get list of category IDs that this post belongs to | |
| $cats = array(); | |
| if ( $categories = get_the_category() ) { | |
| foreach ( $categories as $category ) { | |
| $cats[] = $category->term_id; | |
| } | |
| } | |
| $blogname = get_bloginfo( 'name', 'display' ); |
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 | |
| /** | |
| * Displays a link to edit a field group in the title of a field group for user and taxonomy pages on the backend. | |
| * I recommend moving the JS/CSS to your plugin/theme instead of loading it here. But this is a nice way to keep it portable. | |
| * | |
| * @param $fields | |
| * @param $post_id | |
| * | |
| * @return mixed | |
| */ |