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 | |
$image = abjj_upload_image('profile_picture', $existing_image, 'abjj_process_profile_picture' ); | |
echo '<pre style="font-size: 11px;">RESULT: ---------------------------', "\n", | |
htmlspecialchars( print_r( $image, true)), | |
'</pre>'; | |
exit; | |
// Other functions | |
// Either process and upload a new image, or retrieve the old image | |
// $process is a callback that allows the image to be processed once uploaded via Wordpress' image editor |
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 wpsc_get_owned_products( $user_id = false ) { | |
global $user_purchases, $wpdb; | |
// Get current user by default | |
if ( !$user_id ) { | |
$current = wp_get_current_user(); | |
if ($current) $user_id = $current->ID; | |
else return false; |
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 | |
/* -------------------------------------------------- | |
/ If used within a plugin, you will want to run this function on plugin activation | |
/ For development, you can simply call the function below . To do this, uncomment | |
/ the line below, then visit any page. | |
-------------------------------------------------- */ | |
// custom_user_roles(); | |
function custom_user_roles() { |
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
// This script prevents a function from running too frequently. | |
// Pick one of these three variations, then copy the code to a function of your choice. Do not copy the entire script. | |
// VARIATION A: Simply ignore any excessive function calls | |
// VARIATION B: Ignore excessive function calls, but call the function again once the limiter has expired. Ignore parameters. | |
// VARIATION C: Like variation B, call the function after limiter expired - but pass in function's parameters. | |
// Variation A ---------------- | |
// Replace 150 with the rate limit amount of your choice. |
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
/* | |
Accompanying CSS is commented below. | |
Example Usage: | |
show_lightbox("Hello World", "Good morning, friend", {ok_button: true}); | |
--- | |
show_lightbox( title, content, [options] ) | |
Title: The title of the lightbox. Optional. If only title is specified, the title will be used as content instead. |
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
[WORLD_GEN] | |
[TITLE:RAD] | |
[DIM:257:257] | |
[EMBARK_POINTS:1504] | |
[END_YEAR:1050] | |
[BEAST_END_YEAR:300:80] | |
[REVEAL_ALL_HISTORY:1] | |
[CULL_HISTORICAL_FIGURES:1] | |
[ELEVATION:1:400:800:800] | |
[RAINFALL:0:100:400:400] |
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 | |
// Disable sanitization of specific fields by removing the sanitization filter hooks | |
// Note that at least one filter must exist for the field to be saved. | |
function optionsframework_remove_sanitization() { | |
// Text areas | |
remove_filter( 'of_sanitize_textarea', 'of_sanitize_textarea' ); | |
add_filter( 'of_sanitize_textarea', function ($input) { return $input; }); | |
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 | |
/* | |
Include this script then access your wordpress website with the URL ending in: ?wppscan=1 | |
It will go through each post, 10 at a time, and update the views total/daily/weekly/monthly as post meta. | |
This is to co-exist with your own option that saves these values periodically when saving post. That functionality is not included here. | |
*/ | |
global $ld_recalc; |
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
/* | |
HOW TO USE: | |
0. Ensure the admin page has enqueue the media library scripts. Here is an example to include it on the "Page" edit screen (post.php): | |
function page_enqueue_media_scripts() { | |
$screen = get_current_screen(); | |
if ( $screen->base == 'post' && $screen->id == 'page' ) wp_enqueue_media(); | |
} | |
add_action('admin_enqueue_scripts', 'page_enqueue_media_scripts'); |
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 /* | |
Takes a product ID and returns an array that includes all types of variations of the product, and the attributes of that variation. | |
Variations are normally returned as a term object. They belong to the original product ID and the taxonomy name is equal to the attribute name. | |
If a custom variation is provided instead of a term object, the variation will simply be a string of the option's name. | |
Example return result is given below. This is a single product with one attribute and two different variations. | |
Array ( | |
[pa_oregon-training-classes] => Array ( | |
[attribute] => Array ( |