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
// request | |
$curl = curl_init(); | |
curl_setopt_array($curl, array( | |
CURLOPT_URL => "https://api.timewave.nu/v3/oauth/token", | |
CURLOPT_RETURNTRANSFER => true, | |
CURLOPT_ENCODING => "", | |
CURLOPT_MAXREDIRS => 10, | |
CURLOPT_TIMEOUT => 0, | |
CURLOPT_FOLLOWLOCATION => 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
// request | |
$curl = curl_init(); | |
curl_setopt_array($curl, array( | |
CURLOPT_URL => "https://api.timewave.nu/v3/oauth/token", | |
CURLOPT_RETURNTRANSFER => true, | |
CURLOPT_ENCODING => "", | |
CURLOPT_MAXREDIRS => 10, | |
CURLOPT_TIMEOUT => 0, | |
CURLOPT_FOLLOWLOCATION => 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
/** | |
* Генерирует webp копии изображений сразу после загрузки изображения в медиабиблиотеку | |
* | |
* - новые файлы сохраняет с именем name.ext.webp, например, thumb.jpg.webp | |
*/ | |
function gt_webp_generation($metadata) { | |
$uploads = wp_upload_dir(); // получает папку для загрузки медиафайлов | |
$file = $uploads['basedir'] . '/' . $metadata['file']; // получает исходный файл | |
$ext = wp_check_filetype($file); // получает расширение файла |
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 openModal(modalId){ | |
$('.modal-wrapper').children().unwrap(); | |
if(!$(modalId).length){ | |
alert('Ошибка вызова модального окна'); | |
return false; | |
} | |
$(modalId).wrap('<div class="modal-wrapper" style="display:none" />'); | |
$('.modal-wrapper').fadeIn(400); | |
if($('body').height() > $(window).height()){ |
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
// функция circle выполняет до тех пор пока количестве элементов в списке @posts меньше, чем @index | |
// @index = 1, если не указано иное | |
.circle(@index: 1) when (@index =< length(@posts)){ | |
// задаем переменную @post - достаем из списка @posts элемент с порядковым номером @index (который мы сейчас проходим) | |
@post: extract(@posts, @index); | |
// выводим нужные css свойства используя переменную @post | |
.post-type-@{post}{ |
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
<!-- Создание формы --> | |
<div class="pay__wrap"> | |
<form action="<?php echo bloginfo("template_directory") ?>/includes/etc/pay.php" method="post"> | |
<input type="text" name="name" placeholder="Ваше имя" required=""> | |
<input type="text" name="sum" placeholder="Сумма к оплате" required=""> | |
<input type="hidden" name="id" value="<?php the_sub_field('pay__id'); ?>"> | |
<input type="submit" class="pay__btn btn" value="<?php the_sub_field('pay__btn'); ?>" > | |
</form> | |
</div> |
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 | |
$message = ' '; | |
$message .= $_REQUEST; | |
mail('egmalt@ya.ru', 'Связь есть', $message); |
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
<!-- Шаблон для создания сниппета для sublime text 3 | |
В <tabTrigger> вместо название_сниппета вставьте его сокращенное название, примеры: | |
- prp - в <?php ?> поле repeater | |
- ptf - в <?php ?> the_field(); | |
- acft - acf поле text | |
- lbenefits - layout benefits | |
- gimg - <img> для темы garnet | |
В <scope> можно указать расширение документа в котором можно использовать сниппет, например: |
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 | |
require_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-load.php' ); | |
// подключение файлов в вордпресс | |
get_template_part('/includes/GetCourse/autoload'); | |
get_template_part('/includes/GetCourse/core/exceptions/FormatError'); | |
get_template_part('/includes/GetCourse/core/exceptions/ServerError'); | |
get_template_part('/includes/GetCourse/core/exceptions/TokenError'); | |
get_template_part('/includes/GetCourse/core/Config'); | |
get_template_part('/includes/GetCourse/core/Core'); |