Echoing image dimensions
-
Hi, I am trying to echo the image dimensions of a custom logo in my header.php. This is my code so far
functions.php
function mytheme_customize_register( $wp_customize ) { $wp_customize->add_section( 'custom_logo_section' , array( 'title' => __( 'Logo', 'custom' ), 'priority' => 30, 'description' => 'Upload a logo to replace the default site name and description in the header', )); $wp_customize->add_setting( 'custom_logo' ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'custom_logo', array( 'label' => __( 'Logo', 'custom' ), 'section' => 'custom_logo_section', 'settings' => 'custom_logo', ) )); }header.php
<?php if( get_theme_mod( 'custom_logo') ) : ?> <a href='<?php echo esc_url( home_url( '/' ) ); ?>' title='<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?> 'rel='home' class="navbar-brand"><img src='<?php echo esc_url( get_theme_mod( 'custom_logo' ) ); ?> 'width='<?php echo $width; ?>' 'height='<?php echo $height; ?>' 'alt='<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>'></a></div>The width and height integers are not displaying the image width and height dimensions. How can I solve this?
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
The topic ‘Echoing image dimensions’ is closed to new replies.