fix(frontend): keep asset and homepage filters in DOM
This commit is contained in:
1 parent
a0adddce59
commit
7308f055c7
23 files changed
+362
-305
No files matched your search
@@ -150,7 +150,7 @@ if (!function_exists('aksrt_homepage_get_sort_mode')) {
|
||||
$override_sort = get_query_var('aksrt_homepage_sort_override');
|
||||
$sort = is_string($override_sort) && $override_sort !== ''
|
||||
? sanitize_key($override_sort)
|
||||
: (isset($_GET['home_sort']) ? sanitize_key(wp_unslash((string) $_GET['home_sort'])) : $default_sort);
|
||||
: $default_sort;
|
||||
|
||||
return in_array($sort, $allowed, true) ? $sort : $default_sort;
|
||||
}
|
||||
@@ -279,19 +279,15 @@ if (!function_exists('aksrt_homepage_render_sortbar')) {
|
||||
}
|
||||
|
||||
$current = aksrt_homepage_get_sort_mode();
|
||||
$sort_ajax_enabled = class_exists('\AKSRT\Settings\Settings')
|
||||
? \AKSRT\Settings\Settings::homepage_sort_ajax_enabled()
|
||||
: true;
|
||||
$is_dropdown = class_exists('\AKSRT\Settings\Settings')
|
||||
? \AKSRT\Settings\Settings::home_list_sort_dropdown()
|
||||
: false;
|
||||
$base_url = remove_query_arg('home_sort', get_pagenum_link(aksrt_homepage_get_current_page()));
|
||||
$sort_items = aksrt_homepage_get_sort_items();
|
||||
$all_labels = class_exists('\AKSRT\Settings\Settings')
|
||||
? \AKSRT\Settings\Settings::homepage_sort_labels()
|
||||
: $sort_items;
|
||||
?>
|
||||
<div class="aksrt-homepage__sortbar" data-sort-ajax="<?php echo $sort_ajax_enabled ? 'true' : 'false'; ?>" aria-label="<?php esc_attr_e('Homepage Sort', 'aksrt'); ?>">
|
||||
<div class="aksrt-homepage__sortbar" aria-label="<?php esc_attr_e('Homepage Sort', 'aksrt'); ?>">
|
||||
<?php if ($is_dropdown) : ?>
|
||||
<div class="aksrt-homepage__sortbar-dropdown">
|
||||
<button type="button" class="aksrt-homepage__sortbar-current" data-sort-dropdown-trigger>
|
||||
@@ -300,26 +296,24 @@ if (!function_exists('aksrt_homepage_render_sortbar')) {
|
||||
</button>
|
||||
<div class="aksrt-homepage__sortbar-dropdown-menu" hidden>
|
||||
<?php foreach ($sort_items as $sort_key => $label) : ?>
|
||||
<a
|
||||
class="aksrt-homepage__sortbar-dropdown-item<?php echo $sort_key === $current ? ' is-active' : ''; ?>"
|
||||
href="<?php echo esc_url(add_query_arg('home_sort', $sort_key, $base_url)); ?>"
|
||||
data-sort="<?php echo esc_attr($sort_key); ?>"
|
||||
>
|
||||
<?php echo esc_html($label); ?>
|
||||
</a>
|
||||
<button type="button"
|
||||
class="aksrt-homepage__sortbar-dropdown-item<?php echo $sort_key === $current ? ' is-active' : ''; ?>"
|
||||
data-sort="<?php echo esc_attr($sort_key); ?>"
|
||||
>
|
||||
<?php echo esc_html($label); ?>
|
||||
</button>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<div class="aksrt-homepage__sortbar-links">
|
||||
<?php foreach ($sort_items as $sort_key => $label) : ?>
|
||||
<a
|
||||
class="aksrt-homepage__sortbar-link<?php echo $sort_key === $current ? ' is-active' : ''; ?>"
|
||||
href="<?php echo esc_url(add_query_arg('home_sort', $sort_key, $base_url)); ?>"
|
||||
data-sort="<?php echo esc_attr($sort_key); ?>"
|
||||
>
|
||||
<?php echo esc_html($label); ?>
|
||||
</a>
|
||||
<button type="button"
|
||||
class="aksrt-homepage__sortbar-link<?php echo $sort_key === $current ? ' is-active' : ''; ?>"
|
||||
data-sort="<?php echo esc_attr($sort_key); ?>"
|
||||
>
|
||||
<?php echo esc_html($label); ?>
|
||||
</button>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
Reference in new issue
Block a user