function show_rubrics($cat = 0) {
$heading = get_categories(array(
'taxonomy'=>'category',
'parent' => $cat,
'hide_empty' => 0,
'exclude' => '1, 20, 22, 24',
'include' => '',
'number' => '0',
'pad_counts' => true,
'meta_query' => array(array('key' => 'id-cat-images',))
));
$rubrics = '';
foreach ($heading as $categories_item) {
$term_taxonomy_id = $categories_item->term_taxonomy_id;
$image_id = get_term_meta ( $term_taxonomy_id, 'id-cat-images', true );
$img = wp_get_attachment_image ( $image_id, 'thumbnail' );
$rubrics .= '<div class="my-class"><div class="my-class"><a href="' . get_category_link( $categories_item->term_id ) . '">' . $img . '<span class="my-class">' . $categories_item->name . '</span></a><span class="my-class">' . $categories_item->category_description . '</span></div></div>';
}
return $rubrics;
}
function show_rubrics($cat = 0) {
$heading = get_categories(array(
'taxonomy'=>'category',
'parent' => $cat,
'hide_empty' => 0,
'exclude' => '1, 20, 22, 24',
'include' => '',
'number' => '0',
'pad_counts' => true,
'meta_query' => array(array('key' => 'id-cat-images',))
));
foreach ($heading as $categories_item) {
$term_taxonomy_id = $categories_item->term_taxonomy_id;
$image_id = get_term_meta ( $term_taxonomy_id, 'id-cat-images', true );
$img = wp_get_attachment_image ( $image_id, 'thumbnail' );
$rubrics = '<div class="my-class"><div class="my-class"><a href="' . get_category_link( $categories_item->term_id ) . '">' . $img . '<span class="my-class">' . $categories_item->name . '</span></a><span class="my-class">' . $categories_item->category_description . '</span></div></div>';
echo $rubrics;
}
}
<?php echo show_rubrics(get_query_var('cat')); ?>
<?php echo show_rubrics(get_query_var('cat')); ?>
function show_rubrics($cat = 0) {
$heading = get_categories(array(
'taxonomy'=>'category',
'parent' => $cat,
'hide_empty' => 0,
'exclude' => '1, 20, 22, 24',
'include' => '',
'number' => '0',
'pad_counts' => true,
'meta_query' => array(array('key' => 'id-cat-images',))
));
foreach ($heading as $categories_item) {
$term_taxonomy_id = $categories_item->term_taxonomy_id;
$image_id = get_term_meta ( $term_taxonomy_id, 'id-cat-images', true );
$img = wp_get_attachment_image ( $image_id, 'thumbnail' );
$rubrics = '<div class="col-lg-3"><div class="show_rubrics_block"><a href="' . get_category_link( $categories_item->term_id ) . '">' . $img . '<span class="name-smail">' . $categories_item->name . '</span></a><span class="small-text">' . $categories_item->category_description . '</span></div></div>';
echo $rubrics;
}
}
echo show_rubrics();
echo show_rubrics(get_query_var('cat'));
<script>
slidr.create('my-slider', {
breadcrumbs: true,
controls: 'border',
direction: 'horizontal',
fade: true,
keyboard: false,
overflow: false,
pause: true,
theme: '#fff',
timing: { 'cube': '0.8s ease-in' },
touch: true,
transition: 'cube'
}).add("h", [<?php echo json_encode($data_arr) ?>]).auto(4000);
</script>
<script>
({здесь настройки для слайдера}).add("h", ['one', 'two', 'three', и т.д.]).auto(4000);
</script>
<script>
({здесь настройки для слайдера}).add("h", [<?php echo $data_arr ?>]).auto(4000);
</script>
if $a > count( $data_arr ){ $a = 0; }
if (have_posts()):
while (have_posts()) : the_post();
static $a;
$data_arr = array('one', 'two', 'three');
$img = get_the_post_thumbnail( get_the_ID(), 'large' );
$img = str_replace('<img', '<img data-slidr="'.$data_arr.'"', $img);
$a++;
return $img;
$slider.='<div><a href="'.get_permalink( $post->ID ).'">' . $img . '</a>';
if($up_options->nivo_settings_showSlideText == 'true') {
$slider .= '<div class="slide">
<h2 class="slidetitle"><a href="'.get_permalink( $post->ID ).'">'.get_the_title().'</a></h2>
<p class="slidetext">'.get_the_excerpt().'</p>
</div>';
}
$slider .= '</div>';
endwhile;
endif;
wp_reset_query();
$slider.= '</div>';
return $slider;
}
$("#mybutton").click(function(){
if(($('#sendform input[name="s"]').val($('.myclass').val()).length) == 0){
return false;
} else {
$('#sendform input[name="s"]').val($('.myclass').val());
goSubmit();
}
Query(document).ready(function($){
$('.myclass').keyup(function(eventObject){
console.log("!")
var searchTerm = $(this).val();
if(searchTerm.length > 2){
if(eventObject.keyCode == 13){
$('#sendform input[name="s"]').val(searchTerm);
goSubmit();
return;
}
$.ajax({
url : '/wp-admin/admin-ajax.php',
type: 'POST',
data:{
'action':'',
'term' :searchTerm
},
success:function(result){
} });
} });
$("#mybutton").click(function(){
$('#sendform input[name="s"]').val(searchTerm);
goSubmit();
})
function goSubmit(){
if(($('#sendform input[name="s"]').val().length) == 0){
return false;
} else {
$('#sendform').submit();
}
}
});
jQuery(document).ready(function($){
$('.myclass').keyup(function(eventObject){
console.log("!")
var searchTerm = $(this).val();
if(searchTerm.length > 2){
if(eventObject.keyCode == 13){
goSubmit(searchTerm);
return;
}
$.ajax({
url : '/wp-admin/admin-ajax.php',
type: 'POST',
data:{
'action':'',
'term' :searchTerm
},
success:function(result){
} });
}
$("#mybutton").click(function(){
if((searchTerm.length) == 0){
return false;
} else {
goSubmit(searchTerm);
}
}) });
function goSubmit(searchTerm){
$('#sendform input[name="s"]').val(searchTerm);
$('#sendform').submit();
}
});
Query(document).ready(function($){
$('.myclass').keyup(function(eventObject){
console.log("!")
var searchTerm = $(this).val();
if(searchTerm.length > 2){
if(eventObject.keyCode == 13){
$('#sendform input[name="s"]').val(searchTerm);
goSubmit(searchTerm);
return;
}
$.ajax({
url : '/wp-admin/admin-ajax.php',
type: 'POST',
data:{
'action':'',
'term' :searchTerm
},
success:function(result){
} });
}
$("#mybutton").click(function(){
goSubmit();
}) });
function goSubmit(searchTerm){
if(($('#sendform input[name="s"]').val().length) == 0){
return false;
} else {
$('#sendform').submit();
}
}
});
А без
$rubrics = '';
тоже работает, на что он влияет ?