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_action( 'template_redirect', 'set_last_modified_headers', 999 ); | |
function set_last_modified_headers() { | |
if ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) | |
|| ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) | |
|| ( defined( 'REST_REQUEST' ) && REST_REQUEST ) | |
|| ( is_admin() ) ) { | |
return; |
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
На некторых хостингах, в том числе хостинге 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 | |
// 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
<?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
( function ( $ ) { | |
$( function () { | |
/** | |
* Раскрывает первый элемент виджета Toggle по умолчанию. | |
*/ | |
$( '.elementor-toggle-item:first-child' ) | |
.children( '.elementor-tab-title' ) | |
.addClass( 'elementor-active' ) | |
.attr({ | |
'aria-expanded': 'true', |
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 | |
/* | |
WPML checks for gutenberg like this: | |
\WPML_Page_Builders_Defined->has() | |
``` | |
if ( 'gutenberg' === $page_builder ) { | |
if ( version_compare( $wp_version, '5.0-beta1', '>=' ) ) { | |
return true; | |
} | |
} |
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 | |
// Do not include this PHP opening tag if PHP is already opened... | |
// Ref: https://theseoframework.com/docs/using-filters/ | |
add_filter( 'the_seo_framework_image_generation_params', 'my_tsf_custom_image_generation_args', 10, 3 ); | |
/** | |
* Adjusts image generation parameters. | |
* | |
* @link https://theseoframework.com/docs/api/filters/#append-image-generators-for-social-images |
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
/** | |
* Plural forms for russian words | |
* @param {Integer} count quantity for word | |
* @param {Array} words Array of words. Example: ['депутат', 'депутата', 'депутатов'], ['коментарий', 'коментария', 'комментариев'] | |
* @return {String} Count + plural form for word | |
*/ | |
function pluralize(count, words) { | |
var cases = [2, 0, 1, 1, 1, 2]; | |
return count + ' ' + words[ (count % 100 > 4 && count % 100 < 20) ? 2 : cases[ Math.min(count % 10, 5)] ]; | |
} |
NewerOlder