Add dashboard logo

This commit is contained in:
Hoang Huu 2019-09-25 15:48:34 +07:00
parent f5f29f508c
commit f7efadf4aa
2 changed files with 41 additions and 14 deletions

View File

@ -46,7 +46,6 @@ class Opalestate_Settings_General_Tab extends Opalestate_Settings_Base_Tab {
'before_row' => '<hr>', 'before_row' => '<hr>',
'after_row' => '<hr>', 'after_row' => '<hr>',
], ],
[ [
'name' => esc_html__( 'User Management Page', 'opalestate-pro' ), 'name' => esc_html__( 'User Management Page', 'opalestate-pro' ),
'desc' => esc_html__( 'This is page use User Management Page using for show content of management page such as profile, my properties', 'opalestate-pro' ), 'desc' => esc_html__( 'This is page use User Management Page using for show content of management page such as profile, my properties', 'opalestate-pro' ),
@ -54,6 +53,23 @@ class Opalestate_Settings_General_Tab extends Opalestate_Settings_Base_Tab {
'type' => 'select', 'type' => 'select',
'options' => $pages, 'options' => $pages,
], ],
[
'name' => esc_html__( 'Dashboard Logo', 'opalestate-pro' ),
'desc' => esc_html__( 'Upload a logo for user dashboard page.', 'opalestate-pro' ),
'id' => 'dashboard_logo',
'type' => 'file',
'preview_size' => [ 100, 100 ],
'options' => [
'url' => false,
],
'query_args' => [
'type' => [
'image/gif',
'image/jpeg',
'image/png',
],
],
],
[ [
'name' => esc_html__( 'My Account Page', 'opalestate-pro' ), 'name' => esc_html__( 'My Account Page', 'opalestate-pro' ),
'desc' => esc_html__( 'This is page use User login and register an account, or reset password.', 'opalestate-pro' ), 'desc' => esc_html__( 'This is page use User login and register an account, or reset password.', 'opalestate-pro' ),

View File

@ -70,7 +70,16 @@ if ( $current_user->display_name !== $current_user->user_login ) {
<div class="opal-row-inner"> <div class="opal-row-inner">
<div class=" user-dasboard-sidebar"> <div class=" user-dasboard-sidebar">
<div class="navbar-brand"> <div class="navbar-brand">
<?php if ( ! has_custom_logo() ) { ?> <?php if ( $dashboard_logo_id = opalestate_get_option( 'dashboard_logo_id' ) ) : ?>
<?php
printf(
'<a href="%1$s" class="custom-logo-link" rel="home">%2$s</a>',
esc_url( home_url( '/' ) ),
wp_get_attachment_image( $dashboard_logo_id, 'full' )
);
?>
<?php else : ?>
<?php if ( ! has_custom_logo() ) : ?>
<?php if ( is_front_page() && is_home() ) : ?> <?php if ( is_front_page() && is_home() ) : ?>
<h1 class="navbar-brand mb-0"> <h1 class="navbar-brand mb-0">
<a rel="home" href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" itemprop="url"> <a rel="home" href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" itemprop="url">
@ -78,13 +87,15 @@ if ( $current_user->display_name !== $current_user->user_login ) {
</a> </a>
</h1> </h1>
<?php else : ?> <?php else : ?>
<a class="navbar-brand" rel="home" href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" itemprop="url"> <a class="navbar-brand" rel="home" href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>"
itemprop="url">
<?php bloginfo( 'name' ); ?> <?php bloginfo( 'name' ); ?>
</a> </a>
<?php endif; ?> <?php endif; ?>
<?php } else { <?php else :
the_custom_logo(); the_custom_logo();
} ?><!-- end custom logo --> endif; ?><!-- end custom logo -->
<?php endif; ?>
</div> </div>
<div class="user-dasboard-sidebar-inner"> <div class="user-dasboard-sidebar-inner">