Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add logo option to the customizer #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion header.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/"><img src="<?php echo get_template_directory_uri(); ?>/images/wordpress-charlotte-logo.png" alt="WordPress Charlotte, NC" /></a>
<?php if ( get_theme_mod( 'wpclt_logo') != "" ) { ?>
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" class="navbar-brand" rel="home">
<img id="logo" class="site-logo" src="<?php echo get_theme_mod( 'wpclt_logo' ); ?>">
</a>
<?php } else { ?>
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" class="navbar-brand site-title" rel="home"><?php bloginfo( 'name' ); ?></a>
<?php } ?>
<?php //<h2 class="site-description"><?php bloginfo( 'description' ); ? ></h2> ?>
</div>
<div class="navbar-collapse collapse redBorder">
Expand Down
21 changes: 21 additions & 0 deletions inc/customizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,27 @@ function wpclt_customize_register( $wp_customize ) {
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';


$wp_customize->add_setting(
'wpclt_logo',
array(
'default' => '',
)
);

$wp_customize->add_control(
new WP_Customize_Image_Control(
$wp_customize,
'custom_logo',
array(
'label' => esc_html__( 'Your Logo', 'wpclt' ),
'section' => 'title_tagline',
'settings' => 'wpclt_logo',
'context' => 'wpclt-custom-logo'
)
)
);
}
add_action( 'customize_register', 'wpclt_customize_register' );

Expand Down