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 function removes emoji from string | |
* Used to filter Twilio SMS/MMS for emoji characters and send messages using GSM instead of UCS-2 | |
* | |
* Usage remove_emoji('Lorem ipsum 🥊dolor 🤒sit amet, consectetur adipiscing 🍂 elit. 🌰🍁🌿🌾🌼🌻'); | |
*/ | |
function remove_emoji($text){ | |
return preg_replace('/[\x{1F3F4}](?:\x{E0067}\x{E0062}\x{E0077}\x{E006C}\x{E0073}\x{E007F})|[\x{1F3F4}](?:\x{E0067}\x{E0062}\x{E0073}\x{E0063}\x{E0074}\x{E007F})|[\x{1F3F4}](?:\x{E0067}\x{E0062}\x{E0065}\x{E006E}\x{E0067}\x{E007F})|[\x{1F3F4}](?:\x{200D}\x{2620}\x{FE0F})|[\x{1F3F3}](?:\x{FE0F}\x{200D}\x{1F308})|[\x{0023}\x{002A}\x{0030}\x{0031}\x{0032}\x{0033}\x{0034}\x{0035}\x{0036}\x{0037}\x{0038}\x{0039}](?:\x{FE0F}\x{20E3})|[\x{1F441}](?:\x{FE0F}\x{200D}\x{1F5E8}\x{FE0F})|[\x{1F468}\x{1F469}](?:\x{200D}\x{1F467}\x{200D}\x{1F467})|[\x{1F468}\x{1F469}](?:\x{200D}\x{1F467}\x{200D}\x{1F466})|[\x{1F468}\x{1F469}](?:\x{200D}\x{1F467})|[\x{1F468}\x{1F469}](?:\x{200D}\x{1F466}\x{200D}\x{1F466})|[\x{1F468}\x{1F469}](?:\x{200D}\x{1F466})|[\ |
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 | |
/* | |
* Replace social icon from social icon block on WordPress. | |
* In this case we are replacing the wordpress icon for a custom svg one. | |
*/ | |
add_filter( | |
'render_block', | |
function( $block_content, $block ) { | |
if ( 'core/social-link' === $block['blockName'] && 'wordpress' === $block['attrs']['service'] ) { |
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
[program:app1-laravel-worker] | |
process_name=%(program_name)s_%(process_num)02d | |
command=<your-php-path> <your-artisan-path> queue:work --tries=3 | |
autostart=true | |
autorestart=true | |
numprocs=2 | |
redirect_stderr=true | |
stdout_logfile=<your-logfile-path> | |
[program:app2-laravel-worker] |
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 | |
add_action('woocommerce_order_status_processing', 'send_custom_email_for_local_pickup', 10, 1); | |
function send_custom_email_for_local_pickup($order_id) { | |
if (!$order_id) return; | |
// Obtener el pedido | |
$order = wc_get_order($order_id); |
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 | |
/* | |
* Add new role for Marketing Analytics in WooCommerce | |
* | |
* @author Daniel P. - charrua.es | |
*/ | |
$analytics_role = add_role( | |
'manage_store_analytics', |
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 | |
/** | |
* Add thumbnail to Next Post/ Previous post. | |
* | |
* @param array $args Arguments for next post / previous post links. | |
* @return array | |
*/ | |
function astra_change_next_prev_text( $args ) { | |
$next_post = get_next_post(); |
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
//Please add this to your functions.php | |
/** | |
* This snippet adds Blog page Gutenberg content before the posts grid on Astra theme if you are using a static homepage. | |
* | |
* First create a page for displaying posts, for example "Blog", add any Gutenberg block. | |
* Then on settings assign a static frontpage and the created "Blog" page to blog posts. | |
* | |
* You can now add any block content to the "Blog" page and it will be shown before the posts loop. | |
*/ |
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 | |
// Create file "find.php" inside public_html, replace the path, open in browser. | |
// The script will find files modified in the last 2 days. | |
$files_modifiied = shell_exec('find /home1/cpanel_username/public_html/ -type f -mtime -2'); | |
echo "<pre>$files_modifiied</pre>"; | |
?> |
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
<script> | |
gform.addAction( 'gform_input_change', function( elem, formId, fieldId ) { | |
if ( fieldId == 13 ) { | |
valorCampoDate = elem.value; | |
var parts = valorCampoDate.split( '/' ); | |
// Presta atención al mes ( parts[1] ); JavaScript cuenta los meses desde 0: | |
// Enero - 0, Febrero - 1, etc. | |
var myDate = new Date( parts[2], parts[1] - 1, parts[0] ); | |
// Cambiar el valor del campo oculto. |
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 | |
/** | |
* Add an admin menu link for Reusable Blocks | |
*/ | |
function my_reusable_blocks_admin_menu() { | |
add_menu_page( 'Reusable Blocks', 'Reusable Blocks', 'edit_posts', 'edit.php?post_type=wp_block', '', 'dashicons-editor-table', 22 ); | |
} | |
add_action( 'admin_menu', 'my_reusable_blocks_admin_menu' ); |
NewerOlder