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 | |
искать по фразе - if(!preg_match("(.*),(.*)", $arParams["ICON_SIZE"])) $arParams["ICON_SIZE"] |
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('init', 'register_post_types'); | |
function register_post_types(){ | |
register_post_type('post_type_name', array( | |
'label' => null, | |
'labels' => array( | |
'name' => 'contacts', // основное название для типа записи | |
'singular_name' => 'Контакт', // название для одной записи этого типа | |
'add_new' => 'Добавить контакт', // для добавления новой записи |
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_filter('post_thumbnail_html', 'true_thumbnail_url_only', 10, 5); | |
function true_thumbnail_url_only( $html ){ | |
return preg_replace('#.*src="([^\"]+)".*#', '\1', $html); | |
} |
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 | |
// параметры по умолчанию | |
$args = array( | |
'numberposts' => 3, | |
'category' => 8, | |
'orderby' => 'date', | |
'order' => 'DESC', | |
'post_type' => 'post', | |
'suppress_filters' => true, // подавление работы фильтров изменения SQL запроса | |
); |
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 isValidEmailAddress(emailAddress) { | |
var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i); | |
return pattern.test(emailAddress); | |
} |
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 | |
//Полная версия без комментариев в самом низу | |
//what pagination page are we on? | |
if(! empty($_GET['pag']) && is_numeric($_GET['pag']) ){ | |
$paged = $_GET['pag']; | |
}else{ | |
$paged = 1; | |
} |
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
<!-- Html Template --> | |
<div> | |
<?php global $woocommerce; ?> | |
Cart <span class="cart_counter">(<?php echo sprintf($woocommerce->cart->cart_contents_count); ?>)</span> | |
</div> | |
<? //functions.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 | |
// параметры по умолчанию | |
$args = array( | |
'numberposts' => -1, | |
'category' => 0, | |
'orderby' => 'date', | |
'order' => 'DESC', | |
'include' => array(), | |
'exclude' => 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 | |
// только нужно её скрыть, но чтобы она была доступна для клика | |
add_action( 'wp_footer', 'cart_update_qty_script' ); | |
function cart_update_qty_script() { | |
if (is_cart()) : | |
?> | |
<script> |
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 | |
// Получение массива категорий(рубрик) | |
$all_categories = get_categories(array( | |
'hide_empty' => 0, | |
'taxonomy' => 'services-cat', | |
)); | |
// Перебор массива. | |
foreach( $all_categories as $single_cat ){ | |
$image = get_field('service_tax_image', $single_cat->taxonomy . '_' . $single_cat->term_id); |