Updates how default view mode is set in the template tags.
This commit is contained in:
parent
736d0a5c91
commit
b4df7f7e1c
|
@ -423,22 +423,27 @@ class Theme_Helper {
|
|||
|
||||
// Loads info related to view modes
|
||||
$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'];
|
||||
if ( !in_array($default_view_mode, $enabled_view_modes) ) {
|
||||
$default_view_mode = $enabled_view_modes[0];
|
||||
}
|
||||
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];
|
||||
}
|
||||
|
||||
// Loads info related to sorting
|
||||
$default_order = 'ASC';
|
||||
if ( isset($args['default_order']) ) {
|
||||
|
@ -471,7 +476,7 @@ class Theme_Helper {
|
|||
$props .= "term-id='" . $term->term_id . "' ";
|
||||
$props .= "taxonomy='" . $term->taxonomy . "' ";
|
||||
}
|
||||
|
||||
|
||||
$props .= "default-view-mode='" . $default_view_mode . "' ";
|
||||
$props .= "enabled-view-modes='" . implode(',', $enabled_view_modes) . "' ";
|
||||
$props .= "default-order='" . $default_order . "' ";
|
||||
|
|
Loading…
Reference in New Issue