Updates how default view mode is set in the template tags.

This commit is contained in:
mateuswetah 2021-12-10 15:13:01 -03:00
parent 736d0a5c91
commit b4df7f7e1c
1 changed files with 11 additions and 6 deletions

View File

@ -425,19 +425,24 @@ class Theme_Helper {
$view_modes = tainacan_get_the_view_modes();
$enabled_view_modes = $view_modes['enabled_view_modes'];
$default_view_mode = $view_modes['default_view_mode'];
// If we have a default view mode set, set it
if ( isset($args['default_view_mode']) ) {
$default_view_mode = $args['default_view_mode'];
unset($args['default_view_mode']);
}
$default_view_mode = $view_modes['default_view_mode'];
// If we have custom enabled view modes set, set it
if ( isset($args['enabled_view_modes']) ) {
$enabled_view_modes = $args['enabled_view_modes'];
unset($args['enabled_view_modes']);
}
// Checks if after updating the previous two, the default view mode is still valid
if ( !in_array($default_view_mode, $enabled_view_modes) ) {
$default_view_mode = $enabled_view_modes[0];
}
unset($args['enabled_view_modes']);
}
// Loads info related to sorting
$default_order = 'ASC';