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 | |
/* | |
Plugin Name: Movie Reviews | |
Plugin URI: http://wp.tutsplus.com/ | |
Description: Declares a plugin that will create a custom post type displaying movie reviews. | |
Version: 1.0 | |
Author: Soumitra Chakraborty | |
Author URI: http://wp.tutsplus.com/ | |
License: GPLv2 | |
*/ |
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 /var/www/project/yii mailer/send | |
<?php | |
// регистрируем пятиминутный интервал | |
add_filter( 'cron_schedules', 'cron_add_five_min2234124124124' ); | |
function cron_add_five_min2234124124124( $schedules ) { | |
$schedules['twenty_min_аaa'] = array( | |
'interval' => 60 * 20, | |
'display' => 'Раз в 20 минут' | |
); |
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 | |
//получить Id заказов бронирования авто | |
public static function get_orders_ids($order_status = array('wc-completed')){ | |
global $wpdb; | |
$product_id = self::$settings['woo_id_product']; | |
$results = $wpdb->get_col(" | |
SELECT order_items.order_id | |
FROM {$wpdb->prefix}woocommerce_order_items as order_items | |
LEFT JOIN {$wpdb->prefix}woocommerce_order_itemmeta as order_item_meta ON order_items.order_item_id = order_item_meta.order_item_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
Date.prototype.yyyymmdd = function() { | |
var mm = this.getMonth() + 1; // getMonth() is zero-based | |
var dd = this.getDate(); | |
return [this.getFullYear(), | |
(mm>9 ? '' : '0') + mm, | |
(dd>9 ? '' : '0') + dd | |
].join('/'); | |
}; | |
Jan02_1970.yyyymmdd() |
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 | |
$str = '15:17 14.09.2019'; | |
$d = strtotime($str); | |
echo date_diff(new DateTime(), new DateTime('15:17 15.09.2019'))->days; | |
// format | |
$str = '2019-07-27T10:44:15+10:00'; | |
$d = date("jS F, Y", strtotime($str)); |
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 | |
//получить Id заказов бронирования авто | |
public static function get_orders_ids($order_status = array('wc-completed', 'wc-on-hold')){ | |
global $wpdb; | |
$product_id = self::$settings['woo_id_product']; | |
$results = $wpdb->get_col(" | |
SELECT order_items.order_id | |
FROM {$wpdb->prefix}woocommerce_order_items as order_items | |
LEFT JOIN {$wpdb->prefix}woocommerce_order_itemmeta as order_item_meta ON order_items.order_item_id = order_item_meta.order_item_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 | |
// show rating plagin | |
add_action( 'woocommerce_after_shop_loop_item', 'bbloomer_custom_action', 15 ); | |
function bbloomer_custom_action() { | |
if(function_exists('the_ratings')) { the_ratings(); } | |
} | |
// | |
add_action( 'comment_form_logged_in_after', 'extend_comment_custom_fields' ); |
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 | |
function divie_add_option_field_to_general_admin_page(){ | |
$option_name = 'divie_company_location'; | |
register_setting( 'general', $option_name ); | |
add_settings_field( | |
'myprefix_setting-id', | |
'Локация компании', | |
'divie_setting_callback_location_gen_opt', | |
'general', |
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 | |
require_once( ABSPATH . 'wp-admin/includes/image.php' ); | |
require_once( ABSPATH . 'wp-admin/includes/file.php' ); | |
require_once( ABSPATH . 'wp-admin/includes/media.php' ); | |
$file_array = []; | |
$tmp = download_url($this->infoProduct[0]['image_src'][0]); | |
preg_match('/[^\?]+\.(jpg|jpe|jpeg|gif|png)/i', $this->infoProduct[0]['image_src'][0], $matches ); | |
$file_array['name'] = basename($matches[0]); | |
$file_array['tmp_name'] = $tmp; |
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 | |
$data = [ | |
'attribute_names' => ['pa_article','pa_land'], | |
'attribute_values' => ['279','222'], | |
'attribute_position' => ['0','0'], | |
'attribute_visibility' => ['1','1'], | |
]; | |
$attributes = WC_Meta_Box_Product_Data::prepare_attributes( $data ); |