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 | |
/** | |
* Add custom columns in Users area in the CMS | |
* @param $columns | |
* | |
* @return mixed | |
*/ | |
function doublee_manage_users_columns($columns) { | |
$columns['join_date'] = 'Join date'; |
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 | |
/** | |
* Utility function to create a zip file from an array of file URLs | |
* Used for download links in emails | |
* @param array $files | |
* @param string $filename | |
* | |
* @return string | |
*/ | |
function doublee_zip_order_files(array $files, string $filename) { |
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 | |
/** | |
* Add base tier option to Advanced tab of subscription product | |
*/ | |
function doublee_subscription_product_advanced_settings() { | |
$product = wc_get_product(get_the_id()); | |
if($product->get_type() === 'variable-subscription') { | |
$variations = $product->get_available_variations(); | |
$variation_options = array(); | |
foreach ($variations as $variation) { |
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
/** | |
* Convert milliseconds to the desired format | |
* @param milliseconds | |
* @param format | |
* @returns {*} | |
* @see https://gist.github.com/flangofas/714f401b63a1c3d84aaa | |
*/ | |
function convertMilliseconds(milliseconds, format) { | |
var total_days, total_hours, total_minutes, total_seconds; |
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 doublee_log_all_actions() { | |
foreach($GLOBALS['wp_actions'] as $action => $count) { | |
error_log(print_r($action, true)); | |
} | |
} | |
add_action('shutdown', 'doublee_log_all_actions'); |
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
function myDelayedThing() { | |
var mySelectors = document.querySelectorAll('.something'); | |
// Loop through mySelectors | |
for(var i = 0; i < menuLinks.length; i++) { | |
// Add 'open' class on mouseover | |
menuLinks[i].addEventListener('mouseover', function() { | |
this.classList.add('open'); |
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
/** | |
* Custom Image Catalog script that runs for all subfolders in a selected folder. | |
* Lays out each folder of images in the specified number of rows and columns, 2 folders per page, shows an alert if there's more images than allowed for, | |
* labels each group with the folder name, creates paragraph styles for the captions and group headings, and saves the file. | |
* | |
* Based on the built-in Image Catalog script but modified and simplified (e.g. hard-coding the settings) for my use case. | |
* Could be modified to suit different numbers of folders per page, different image quantities etc by changing the settings at the top | |
* and making tweaks to other code as needed. | |
* | |
* Could also be extended to show one dialog for settings prior to the loop, |
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
/** | |
* Move the excerpt metabox to the top | |
* @param $post_type | |
*/ | |
function doublee_custom_excerpt_metabox( $post_type ) { | |
if(in_array($post_type, array('post','page'))) { | |
add_meta_box( | |
'excerpt_meta', __( 'Excerpt' ), 'post_excerpt_meta_box', $post_type, 'temp', 'high' | |
); | |
} |
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 | |
/** | |
* The SEO Framework + ACF flexible content integration | |
* TSF will look at the excerpt and then the content to generate the default meta description. | |
* If both of those are empty, this code looks for ACF flexible modules to get it from. | |
* // TODO: Make this work with archives as well as posts | |
* @param $description | |
* @param $args | |
* | |
* @return mixed|string |