$(document).ready(function () {
Fancybox.bind("[data-fancybox]", {
Carousel: {
Navigation: {
prevTpl:
'<button tabindex="0" title="Назад" class="f-button is-prev" data-carousel-prev="true">' +
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1"><path d="M15 3l-9 9 9 9"></path></svg>' +
"</button>",
nextTpl:
'<button tabindex="0" title="Далее" class="f-button is-next" data-carousel-next="true">' +
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1"><path d="M9 3l9 9-9 9"></path></svg>' +
"</button>",
},
},
});
});
<select name="category" id="category-select">
<option value="">Выберите из списка</option>
<?php
$categories = get_terms(array(
'taxonomy' => 'category',
'hide_empty' => false,
'orderby' => 'term_order',
'order' => 'ASC',
));
function display_category_options($categories, $parent = 0, $depth = 0) {
foreach ($categories as $category) {
if ($category->parent == $parent) {
$indent = str_repeat(' ', $depth * 4);
echo '<option value="' . esc_url(get_category_link($category->term_id)) . '">' . $indent . esc_html($category->name) . '</option>';
display_category_options($categories, $category->term_id, $depth + 1);
}
}
}
display_category_options($categories);
?>
</select>
<script>
document.getElementById('category-select').addEventListener('change', function() {
const selectedValue = this.value;
if (selectedValue) {
window.location.href = selectedValue;
}
});
</script>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<!---миниатюра -->
<?php if ( has_post_thumbnail() ) : ?>
<div class="post-thumbnail">
<?php the_post_thumbnail(); ?>
</div>
<?php endif; ?>
<!---/миниатюра -->
<h2><?php the_title(); ?></h2>
<div><?php the_content(); ?></div>
<?php endwhile; endif; ?>