Skip to content

Instantly share code, notes, and snippets.

View BKeanu1989's full-sized avatar

Kevin Fechner BKeanu1989

View GitHub Profile
<?php
function delete_orders() {
global $wpdb;
$order_ids = $wpdb->get_col("SELECT ID FROM {$wpdb->prefix}posts WHERE post_type = 'shop_order'");
foreach($order_ids AS $order_id) {
$order_id = (int) $order_id;
wp_delete_post($order_id, true);
}
@BKeanu1989
BKeanu1989 / test.php
Created May 6, 2019 22:26
date from Strings with fixed start & end date
<?php
$festivalStart = '2019-07-29';
$festivalEnd = '2019-08-04';
$germanDays = ['Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag', 'Sonntag'];
$englishDays = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
function get_begin_N_end_from_time_span($timeSpanString)
{
preg_match('/(?P<begin>\w+).{0,3} (?P<end>\w+)/', $timeSpanString, $matches);
function woo_add_product_gender() {
echo '<div class="options_group">';
woocommerce_wp_select(
array(
'id' => '_product_gender',
'label' => __( 'Gender', 'woocommerce' ),
'options' => array(
'male' => __( 'Male', 'woocommerce' ),
function variation_settings_fields_rohartikel( $loop, $variation_data, $variation ) {
// Text Field
woocommerce_wp_text_input(
array(
'id' => '_rohartikel[' . $variation->ID . ']',
'label' => __( 'Rohartikelnummer Halle', 'woocommerce' ),
'placeholder' => '002015971001',
'desc_tip' => 'true',
'readonly' => true,
@BKeanu1989
BKeanu1989 / reset-mysql-root-pw.md
Created October 24, 2019 09:24
reset-mysql-root-pw

source: https://devanswers.co/how-to-reset-mysql-root-password-ubuntu/ #mysql 5.7

sudo /etc/init.d/mysql stop sudo mkdir /var/run/mysqld sudo chown mysql /var/run/mysqld

sudo mysqld_safe --skip-grant-tables& sudo mysql --user=root mysql mysql> update user set authentication_string=PASSWORD('your_password_here') where user='root';