Skip to content

Instantly share code, notes, and snippets.

@eto4detak
eto4detak / xls_excel.php
Created March 1, 2019 10:00
wp php xls excel
<?php
/////// ADMIN PAGE SETTINGS AND IMPORT EXPORT
class Divie_Import_Export_XLS
{
function __construct()
@eto4detak
eto4detak / wp-php.php
Last active September 10, 2019 18:13
wp php
<?php
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', true );
define( 'WP_DEBUG_LOG', true );
// role
add_action('init', 'dsgsdhgsafasfasfasf');
function dsgsdhgsafasfasfasf($value='')
@eto4detak
eto4detak / woo-php.php
Last active August 15, 2024 15:16
woo php
<?php
$product = wc_get_product( $post->ID );
// attribute
$razmer = array_shift( wc_get_product_terms( $product->id, 'pa_razmer', array( 'fields' => 'names' ) ) );
$variation_ids = $product->get_children( $args = '', $output = OBJECT );
foreach ($variation_ids as $key => $pv_id) {
$pv = new WC_Product_Variation($pv_id);
$pv_array[] = $pv;
@eto4detak
eto4detak / ajax-reg-form.php
Created May 5, 2019 10:59
wp php ajax reg form
<?php
global $psych_form;
$psych_form = new PsychForm();
class PsychForm
{
public $current_user;
public $current_template;
public $templates = [
'reg' => ['template' => 'page-psych-reg.php', 'url' => ''],
@eto4detak
eto4detak / jq-ajax-form.js
Created May 5, 2019 11:05
js jq ajax form
;
jQuery(document).ready(function() {
"use strict";
(function($) {
$('input.psych-reg-button[type=submit]').on('click touch', '', function(event) {
var qform = $(this).closest('form')[0];
var data = new FormData(qform);
for (let entry of data) {
@eto4detak
eto4detak / wp php validate.php
Last active July 13, 2019 10:57
wp php validate
<?php
if (!empty($_POST['submit']) && $_POST['submit'] == 'up_settings' && isset($_POST['settings'])) {
$fields = array_diff($_POST['settings'], array(''));
foreach ($fields as $key => $value) {
self::update_general_settings($key, $value);
}
}
wp_nonce_field( 'wpestate_regular_search', 'wpestate_regular_search_nonce' );
@eto4detak
eto4detak / woo php code.php
Last active June 5, 2019 08:26
woo php code
<?php
/*========================================================
* add field woo
========================================================*/
add_action('woocommerce_product_options_general_product_data', 'divie_woo_add_custom_fields_euro');
function divie_woo_add_custom_fields_euro()
{
global $product, $post;
@eto4detak
eto4detak / wp php code.php
Last active August 22, 2019 19:11
wp php code
<?php
// добавить к запросу
function devise_number_displayed_posts($query) {
if (is_admin() || !$query->is_main_query()) {
return;
}
if (is_tax('category-catalogs')) {
$query->set('posts_per_page', 16);
return;
}
document.addEventListener('DOMContentLoaded', function(){
EnviarCorreo();
});
function EnviarCorreo()
{
jQuery.ajax({
type: "POST",
url: 'coordinates.php',
data: {},
@eto4detak
eto4detak / php-text.php
Last active October 24, 2019 16:16
php text
<?php
$f = new NumberFormatter("ru", NumberFormatter::SPELLOUT);
echo $f->format(123456);
$content = "Статус посылки НП: </br>"
."Выдано в месте YYYY </br>"
."Ориентировочная доставка до Отделения ЧЧЧЧ dd--mm </br>"
."Ждите дополнительное уведомление при прибытии</br>";