This file contains 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 roomble_ajax_create_order() { | |
// Получить корзину | |
$cart = WC()->cart; | |
$phone = esc_attr( trim( $_REQUEST['phone'] ) ); |
This file contains 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 | |
/** | |
* 1. В таблице wp_options находим ключ yoast-seo-premium_license или wordpress-seo-premium_license | |
* и меняем его значение на `a:3:{s:3:"key";s:6:"zalupa";s:6:"status";s:5:"valid";s:11:"expiry_date";s:19:"2970-01-01 00:00:00";}` | |
* | |
* 2. Чтобы не слетали все ваши махинации после захода на страницу обновления или проверки лицензии, | |
* достаточно запретить плагину ломиться по своему АПИ на свой сайт. | |
* Я это сделал просто: в файле \wordpress-seo-premium\vendor\yoast\license-manager\class-update-manager.php | |
*/ |
This file contains 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 return_canon () { | |
$canon_page = get_pagenum_link( 1 ); | |
return $canon_page; | |
} | |
function canon_paged() { | |
if ( is_paged() ) { | |
add_filter( 'wpseo_canonical', 'return_canon' ); | |
} |
This file contains 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 | |
// PHP memory limit for this site | |
define( 'WP_MEMORY_LIMIT', '128M' ); | |
define( 'WP_MAX_MEMORY_LIMIT', '256M' ); // Increase admin-side memory limit. | |
// Database | |
define( 'WP_ALLOW_REPAIR', true ); // Allow WordPress to automatically repair your database. | |
define( 'DO_NOT_UPGRADE_GLOBAL_TABLES', true ); // Don't make database upgrades on global tables (like users) | |
// Explicitely setting url |
This file contains 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
#! /bin/bash | |
# example csv file, mycsv.csv: | |
# | |
# path,some_field | |
# somepath,some_value | |
# anotherpath,another_value | |
# ... | |
# | |
# run the following command: | |
# ./get_blogid_from_url.sh mycsv.csv myblog.com /wordpress/path > result.csv |
This file contains 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
/** | |
* Check if Gutenberg is active. | |
* Must be used not earlier than plugins_loaded action fired. | |
* | |
* @return bool | |
*/ | |
private function is_gutenberg_active() { | |
$gutenberg = false; | |
$block_editor = false; |
This file contains 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 | |
add_filter( | |
'wp_schema_pro_schema_article', | |
/** | |
* Расширяет микроразметку BlogPosting для Яндекс.Метрики. | |
* | |
* @link https://metrika.yandex.ru/support/metrica/publishers/schema-org/json-ld.html#json-ld__identifier-desc | |
* | |
* @param array $schema Схема. | |
* @param array $data Данные. |
This file contains 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
На некторых хостингах, в том числе хостинге beget, требуется явно указывать версию php для композера, так как версия php в консоли часто отличается от версии, заданной в контрольной панели для сайта. | |
(Текущую версию php для консоли можно узнать командой php -v) | |
Например, для версии 7.4 команда будет такая: | |
composer-php7.4 install | |
Для других версий php алиасы соответствующих версий будут такими: | |
composer-php5.3 | |
composer-php5.4 | |
composer-php5.5 | |
composer-php5.6 |
This file contains 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 | |
/** | |
* CF7 to Telegram | |
*/ | |
namespace Mihdan\Kadence_Child; | |
/** | |
* Class ContactFormToTelegram | |
* |
This file contains 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 | |
$z_cf7_to_tlg_args = [ | |
'bot_token' => '618641506:AAGa_WvKonJOxXpdZCHb66Qsk7erwerwe', | |
'receivers' => [ | |
-7878979791231323, | |
], | |
]; | |
function z_cf7_to_tlg_send_message( $message, $receiver ) { | |
global $z_cf7_to_tlg_args; | |
$params['text'] = wp_strip_all_tags( $message ); |
NewerOlder