Skip to content

Instantly share code, notes, and snippets.

View KarasAlina's full-sized avatar
🦄

Alina Karas KarasAlina

🦄
  • E-produce
  • Krasnodar
View GitHub Profile
@KarasAlina
KarasAlina / gist:1c29818693a2ff8aed2d
Created December 15, 2015 11:06
Вывод текста в Repeater
<?php echo get_sub_field('text_slide') ?>
<div class="row">
<div class="col-md-12">
<div class="breadcrumbs">
<?php if (is_home()) { ?>
<?php } elseif (is_page()) { ?>
<a href="<?php echo get_option('home'); ?>">Главная</a> >
<?php foreach((get_the_category()) as $cat) {
$cat=$cat->cat_ID;
echo(get_category_parents($cat, TRUE, ' > ')); } the_title(); ?>
<?php } ?>
<?php get_header() ?>
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="breadcrumbs">
<?php if (is_home()) { ?>
<?php } elseif (is_page()) { ?>
<a href="<?php echo get_option('home'); ?>">Главная</a> >
<?php foreach((get_the_category()) as $cat) {
$cat=$cat->cat_ID;
<meta name="viewport" content="width=1280, initial-scale=10, maximum-scale=0.5, user-scalable=10">
<?php
/*
* Paginate Advanced Custom Field repeater
*/
if( get_query_var('page') ) {
$page = get_query_var( 'page' );
} else {
$page = 1;
}
<?php
if (is_single()) {
$cat = get_the_category();
$cat = $cat[0]->cat_ID;
$currentCat = '&current_category='.$cat;
}
wp_list_categories('orderby=id&exclude=1&hide_empty=0&orderby=name&show_count=0&title_li='.$currentCat);
?>
@KarasAlina
KarasAlina / category.php для дочерних
Created July 27, 2016 10:37
Использование шаблона родительских рубрик для дочерних. Слаг у родительской рубрики надо указать такой же как и слаг у файла category-_____.php
add_action('template_redirect', 'wpds_parent_category_template');
function wpds_parent_category_template()
{
if (!is_category())
return true;
// получаем объект текущей рубрики
$cat = get_category(get_query_var('cat'));
while ($cat && !is_wp_error($cat)) {
@KarasAlina
KarasAlina / gist:ba949140f17911df32e23351ab115677
Created August 29, 2016 12:13
Закрыть блок при клике вне его пределов
$(document).on('click', function(e) {
if (!$(e.target).closest(".parent_block").length) {
$('.toggled_block').hide();
}
e.stopPropagation();
});
<div class="basket">
<div class="lab">Корзина</div>
<input type="number" class="count-length" value="<?php echo WC()->cart->get_cart_contents_count(); ?>">
<span class="bas-price"><?php echo WC()->cart->get_cart_subtotal(); ?></span>
<a href="<?php echo WC()->cart->get_cart_url(); ?>" class="bas-inside"></a>
</div>
jQuery(document).ready(function($) {
var url=document.location.href;
$.each($("#preface-top a"),function(){
if(this.href==url){$(this).addClass('activeCSS');};
});
})(jQuery);