Skip to content

Instantly share code, notes, and snippets.

Musilek Vladislav Musilda

Block or report user

Report or block Musilda

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View media-file-rename.php
<?php
$chars = array (
/** Cyrillics **/
'А' => 'A', 'Б' => 'B', 'В' => 'V', 'Г' => 'G',
'Д' => 'D', 'Е' => 'E', 'Ё' => 'E', 'Ж' => 'Zh',
'З' => 'Z', 'И' => 'I', 'Й' => 'I', 'К' => 'K',
'Л' => 'L', 'М' => 'M', 'Н' => 'N', 'О' => 'O',
'П' => 'P', 'Р' => 'R', 'С' => 'S', 'Т' => 'T',
'У' => 'U', 'Ф' => 'F', 'Х' => 'Kh', 'Ц' => 'Ts',
View add-copy-to-customer-email-woocommerce.php
<?php
add_filter( 'woocommerce_email_recipient_customer_completed_order', 'your_email_recipient_filter_function', 10, 2);
function your_email_recipient_filter_function($recipient, $object) {
$recipient = $recipient . ', me@myemail.com';
return $recipient;
}
add_filter( 'woocommerce_email_headers', 'mycustom_headers_filter_function', 10, 2);
View hide-subcategory-count.php
<?php
/**
* Hide category product count in product archives
*/
add_filter( 'woocommerce_subcategory_count_html', '__return_false' );
View use-script-debug.php
<?php
// Use minified libraries if SCRIPT_DEBUG is turned off
$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
wp_enqueue_script( 'my-script-handle', plugin_dir_url( __FILE__ ) . 'assets/my-file' . $suffix . '.js', array( 'jquery' ) );
View publish-hidden-post-after-one-month.php
<?php
add_action( 'publish_post_after_month', 'musilda_publish_post_after_month' );
function musilda_publish_post_after_month() {
$post_id = 123;
wp_publish_post( $post_id );
}
add_action( 'init', 'musilda_single_event' );
function musilda_single_event(){
wp_schedule_single_event( 30 * DAY_IN_SECONDS, 'publish_post_after_month' );
View delete-all-failed-orders-wp-cron.php
<?php
// Delete all failed orders custom action
add_action( 'musilda_delete_failed_orders', 'musilda_delete_all_failed_orders' );
// This function will run once the 'musilda_delete_failed_orders' is called
function musilda_delete_all_failed_orders() {
$args = array(
'status' => 'failed',
);
View wp-auto-upload-image-batch.php
<?php
global $wp_aui;
$custom_posts = get_posts($args);
foreach($custom_posts as $post) : setup_postdata($post);
$content = $wp_aui->save($post);
wp_insert_post( array( 'ID' => $post->ID, 'post_content' => $content ) );
endforeach;
View display-variation-sku.php
<?php
//Use template file single-produtc/add-to-cart/variation.php
//Replace code with snippet
?>
<script type="text/template" id="tmpl-variation-template">
<div class="woocommerce-variation-description">{{{ data.variation.variation_description }}}</div>
<div class="woocommerce-variation-price">{{{ data.variation.price_html }}}</div>
<div class="woocommerce-variation-availability">{{{ data.variation.availability_html }}}</div>
<div class="woocommerce-variation-sku"><strong>Katalogové číslo:</strong> {{{ data.variation.sku }}}</div>
</script>
View extend-comgate-blocked-statuses.php
<?php
//Defined
$default_blocked_statuses = array( 'processing', 'completed' );
$blocked_statuses = apply_filters( 'comgate_blocked_statuses', $default_blocked_statuses );
//Snippet
add_filter( 'comgate_blocked_statuses', 'extend_comgate_blocked_statuses' );
function extend_comgate_blocked_statuses( $statuses ){
$statuses[] = 'nezaplaceno';
return $statuses;
View csob-bank-extend-blocked-statuses.php
<?php
//Defined
$statuses = array(
'completed',
'failed',
'cancelled',
'refunded'
);
apply_filters( 'csob_bank_blocked_order_statuses', $statuses );
You can’t perform that action at this time.