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 datePost() { | |
$in_date = date('Y-m-d'); | |
$date = get_the_date( 'Y-m-d'); | |
$datepost = date_create(get_the_date( 'Y-m-d')); | |
date_add($datepost, date_interval_create_from_date_string('3 months')); | |
$to_date = date_format($datepost, 'Y-m-d'); | |
if( $date < $to_date && $in_date < $to_date ) | |
{ | |
echo '<span class="newcategory"></span>'; | |
} |
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 | |
/** | |
* Добавляем стили в админку для ACF | |
* Добавляем функцию создание быстрых ссылок для вкладок на странице редактирования групп полей | |
*/ | |
add_action( 'current_screen', function( $current_screen ) { | |
if ( 'acf-field-group' == $current_screen->post_type && 'post' == $current_screen->base ) { | |
add_action( 'admin_head', 'acf_add_quick_tabs' ); | |
} |
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 | |
/** | |
* Отключаем принудительную проверку новых версий WP, плагинов и темы в админке, | |
* чтобы она не тормозила, когда долго не заходил и зашел... | |
* Все проверки будут происходить незаметно через крон или при заходе на страницу: "Консоль > Обновления". | |
* | |
* @see https://wp-kama.ru/filecode/wp-includes/update.php | |
* @version 1.0 | |
*/ | |
if( is_admin() ){ |
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 | |
/* | |
Plugin Name: Product Category Without Child | |
Description: Выводит товары из указанной рубрики без подгрузки товаров из подрубрик | |
Version: 1.0.0 | |
Author: Campusboy | |
Author URI: https://wp-plus.ru/ | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) { |
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 | |
* | |
* @param [string|null] $dir Directory | |
* @return mixed | |
*/ | |
function dir_to_array( $dir = null ) { | |
$result = array(); |
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 | |
/** | |
* Выводи на экран значение переменной | |
* | |
* @param mixed $data данные для отображения | |
* @param bool $type как отображать данные | |
*/ | |
function d( $data, $type = 0 ) { | |
ob_start(); | |
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
// Автодобавление названия изображения при выборе фотки в поле названия поста | |
add_action( 'admin_print_footer_scripts', function () { | |
global $current_screen; | |
if ( 'post' == $current_screen->post_type && 'post' == $current_screen->base ) { | |
?> | |
<script> | |
jQuery(document).ready(function ($) { | |
var $titlePostInput = $('[name=post_title]'); | |
$(document).on('mouseenter', '.media-button-select', function () { |
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 | |
/** | |
* Изменяет запрос, чтобы работала пагинация на странице category. | |
* | |
* Страница (page) category должна быть создана в админке | |
* и указана в настройках чтения, как "Страница записей" | |
* | |
* $param array $query_vars | |
* | |
* @return array |
OlderNewer