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 | |
/** | |
* @var array<int, array{ | |
* input_value: int, | |
* max_value: int, | |
* min_value: int, | |
* step: int, | |
* }|null> $product_args Array of qty data or null for default - keyed by product ID | |
*/ |
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 to store files into a tar.gz archive using pigz with compression level 1 | |
storeit() { | |
local tarfile=$1 | |
local pathtotar=$2 | |
local cpus=${3:-12} # Default to 12 CPUs if not specified | |
# Count the total number of files and total size for progress bar | |
local totalsize=$(du -sb "$pathtotar" | awk '{print $1}') | |
# Archive and compress with progress bar |
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 | |
global $wpdb; | |
$attachment_ids = $wpdb->get_results( | |
"SELECT | |
ID | |
FROM | |
{$wpdb->posts} | |
WHERE | |
post_type = 'attachment' |
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 | |
namespace Extremis\Core; | |
use PHPMailer\PHPMailer\PHPMailer; | |
class SMTP | |
{ | |
public function __construct() | |
{ |
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
/* | |
list all meta keys and count them | |
*/ | |
SELECT meta_key, COUNT(*) FROM `wp_postmeta` group by meta_key ORDER BY `COUNT(*)` DESC |
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 porto_check_theme_options() { | |
// check default options | |
global $porto_settings; | |
// ob_start(); | |
// include PORTO_ADMIN . '/theme_options/default_options.php'; | |
// $options = ob_get_clean(); | |
// $porto_default_settings = json_decode( $options, true ); | |
// Begin Indian code fix |
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_action('save_post', 'add_attachment_to_autosave'); | |
function add_attachment_to_autosave( $post ) | |
{ | |
if( !wp_is_post_autosave($post) ) : | |
return; | |
endif; | |
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 | |
$product_id = 202; | |
$product_sku = 'SIFRA-1245'; | |
/* | |
This won't work because update_post_meta does not trigger necessary additions to product lookup tables and transients | |
*/ | |
update_post_meta($product_id, '_sku', $product_sku); |
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 | |
namespace Oblak\Addons; | |
use WP_Comment; | |
use WP_Comment_Query; | |
class RecentComments | |
{ | |
private static ?array $comments = null; |