- fix grid default

This commit is contained in:
andrewshuba
2019-09-04 16:27:08 +03:00
parent cf47a578a7
commit 6ac94904e1
2 changed files with 7 additions and 7 deletions
@@ -17,9 +17,9 @@ $show_these_users = get_post_meta( get_the_ID(), '_um_show_these_users', true );
if ( $show_these_users ) {
$show_these_users = implode( "\n", str_replace( "\r", "", $show_these_users ) );
}
$_um_view_types_options = array( 'grid', 'list' );
$_um_view_types_value = get_post_meta( $post_id, '_um_view_types', true );
$_um_view_types_value = empty( $_um_view_types_value ) ? array( 'grid' ) : $_um_view_types_value;
$_um_view_types_value = empty( $_um_view_types_value ) ? array( 'grid', 'list' ) : $_um_view_types_value;
$view_types_options = array_map( function( $item ) {
return $item['title'];
@@ -46,7 +46,7 @@ foreach ( $view_types_options as $key => $value ) {
'tooltip' => __( 'View type a specific parameter in the directory', 'ultimate-member' ),
'options' => $view_types_options,
'columns' => 3,
'value' => $_um_view_types_value,
'value' => $_um_view_types_options,
'data' => array( 'fill__um_default_view' => 'checkbox_key' ),
),
array(
@@ -55,7 +55,7 @@ foreach ( $view_types_options as $key => $value ) {
'label' => __( 'Default view type', 'ultimate-member' ),
'tooltip' => __( 'Default directory view type', 'ultimate-member' ),
'options' => $view_types_options,
'value' => UM()->query()->get_meta_value( '_um_default_view', null, '' ),
'value' => UM()->query()->get_meta_value( '_um_default_view', null, 'grid' ),
'conditional' => array( implode( '|', $conditional ), '~', 1 )
),
array(
+3 -3
View File
@@ -50,7 +50,7 @@ if ( count( $args['view_types'] ) == 1 ) {
$default_sorting = ! empty( $args['sortby'] ) ? $args['sortby'] : 'user_registered_desc';
$sort_from_url = '';
if ( $args['enable_sorting'] ) {
if ( isset( $args['enable_sorting'] ) ) {
$sorting_options = empty( $args['sorting_fields'] ) ? array() : $args['sorting_fields'];
if ( ! in_array( $default_sorting, $sorting_options ) ) {
$sorting_options[] = $default_sorting;
@@ -107,7 +107,7 @@ if ( ! $single_view ) {
$classes .= ' um-member-with-view';
}
if ( $args['enable_sorting'] && ! empty( $sorting_options ) && count( $sorting_options ) > 1 ) {
if ( isset( $args['enable_sorting'] ) && ! empty( $sorting_options ) && count( $sorting_options ) > 1 ) {
$classes .= ' um-member-with-sorting';
}
@@ -141,7 +141,7 @@ UM()->get_template( 'members-pagination.php', '', $args, true ); ?>
</div>
<?php }
if ( $args['enable_sorting'] && ! empty( $sorting_options ) && count( $sorting_options ) > 1 ) { ?>
if ( isset( $args['enable_sorting'] ) && ! empty( $sorting_options ) && count( $sorting_options ) > 1 ) { ?>
<div class="um-member-directory-sorting">
<select class="um-s3 um-member-directory-sorting-options" id="um-member-directory-sorting-select-<?php echo esc_attr( $form_id ) ?>" data-placeholder="<?php esc_attr_e( 'Sort By', 'ultimate-member' ); ?>">
<?php foreach ( $sorting_options as $value => $title ) { ?>