Код: Выделить всё
add_action('foogallery_loaded_template_after', 'foo_tags_dropdown', 100);
function foo_tags_dropdown()
{
?>
jQuery(document).ready(function ($) {
jQuery(function () {
jQuery('ul.fg-tag-list').each(function () {
// Create the Dropdown menu
var $select = jQuery('');
var $anchors = jQuery(this).find('a');
jQuery(this).find('a').each(function () {
var $option = jQuery('');
$option.attr('value', jQuery(this).attr('href')).html(jQuery(this).html());
$select.append($option);
});
// Manually trigger filter logic when dropdown changes
$select.change(function (e) {
var selectedValue = $(this).val();
if (selectedValue) {
var index = $select.prop('selectedIndex');
var tag = $anchors.eq(index)
tag.trigger('click')
}
});
jQuery('.fg-filtering-container').append($select)
jQuery('ul.fg-tag-list').hide()
});
});
});
jQuery(function ($) {
$(".foogallery").foogallery({
"on": {
'ready.foogallery': function (e, tmpl) {
// Do something
}
}
});
});
Подробнее здесь: [url]https://stackoverflow.com/questions/79329993/how-do-i-write-a-plugin-using-jquery-to-extend-foogallery-plugin-without-initia[/url]