Updates how default view mode is set in the template tags.
This commit is contained in:
parent
736d0a5c91
commit
b4df7f7e1c
|
@ -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';
|
||||
|
|
Loading…
Reference in New Issue