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
/* | |
# this will create new .format() function for Date object | |
# there is auto localization from Intl, but you can also set language as a 2nd argument | |
# all possible values were tested and compared on Apache server with PHP 8 date() function | |
# you can find minified version in the first comment | |
# examples: | |
new Date().format('d.m.Y H:i:s') // 25.07.2022 09:11 |
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
/** | |
* Create .csv proof file content | |
* | |
* Puts the email in the first column, selected filenames in the follwing columns, | |
* each recipient on a new line. | |
* | |
* @param string $proof_file_content The original proof file content | |
* @param int $post_id The collection post ID | |
* @return string The filtered proof file content | |
*/ |
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
/** | |
* Use a random collection image as background. | |
* | |
* @param string $custom_styles CSS code; Make sure to add your code to the string and not overwrite it. | |
*/ | |
function my_picu_delivery_random_collection_background( $custom_styles ) { | |
$post = get_post(); | |
$delivery_option = get_post_meta( $post->ID, '_picu_collection_delivery_option', true ); | |
if ( $delivery_option == 'upload' AND ( 'delivery-draft' == $post->post_status OR 'delivered' == $post->post_status ) ) { |
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
// Get number of consecutive days of posting | |
$num = 1; | |
$p = $pages->listed()->last(); | |
while( $p ) { | |
// published = date/time field, substr to only get day accuracy | |
$date = date_create( substr( $p->published(), 0, 10 ) ); | |
$p = $p->prevListed(); | |
$date_prev = date_create( substr( $p->published(), 0, 10 ) ); | |
$diff = date_diff( $date, $date_prev ); |
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
/** | |
* Change the output of the picu_collection_list shortcode | |
* | |
* @param string $collection_list The original html output | |
* @param object $query The query of returned collections | |
* @param array $atts The shortcode attributes | |
* @param string $content The content between the shortcode tags | |
*/ | |
function my_picu_collection_list( $collection_list, $query, $atts, $content ) { | |
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
/** | |
* Complete list of block type slugs as of WordPress 5.3 and WooCommerce Blocks 2.5.3 | |
*/ | |
$block_types = array( | |
// Common blocks | |
'core/paragraph', | |
'core/image', | |
'core/heading', | |
'core/gallery', | |
'core/list', |
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 // Change the default client email message | |
function my_custom_mail_message( $mail_message, $user_name ) { | |
$mail_message = 'Nice! Now I have my own mail message. '; | |
$mail_message .= 'I can even automatically end the message with the current username: ' . $user_name; | |
return $mail_message; | |
} |
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
{ | |
'العربيّة (ar)' => 'ar', | |
'български (bg)' => 'bg', | |
'Bengali (bn)' => 'bn', | |
'català (ca)' => 'ca', | |
'česky (cs)' => 'cs', | |
'dansk (da)' => 'da', | |
'Deutsch (de)' => 'de', | |
'Ελληνικά (el)' => 'el', | |
'English (en)' => 'en', |
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
{ | |
'UTC-12' => '-43200', | |
'UTC-11' => '-39600', | |
'UTC-10' => '-36000', | |
'UTC-9.5' => '-34200', | |
'UTC-9' => '-32400', | |
'UTC-8' => '-28800', | |
'UTC-7' => '-25200', | |
'UTC-6' => '-21600', | |
'UTC-5' => '-18000', |