bhadaway / blankslate

A naked WordPress theme, powering over 10k websites. Buy me a sandwich. 🥪
https://opencollective.com/blankslate
325 stars 92 forks source link

adding custom logo to the page #12

Closed artmelkon closed 3 years ago

artmelkon commented 5 years ago

Hello I am new to wordpress and would like to add custom logo to the page and placed this code in my functions.php, however, it's not sowing on the page. Can you tell me what am I doing wrong. Thanks


add_theme_support('custom-logo', array( 'height' => 54, 'width' => 310, 'flex-height' => true, 'flex-width' => true, 'header-text' => array( 'site-title', 'site-description' ), )); function companyname_logo() { if ( function_exists( 'the_custom_logo' )) { the_custom_logo(); } } $custom_logo_id = get_theme_mod( 'custom_log' ); $custom_logo_url = wp_get_attachment_image_url( $custom_logo_id, 'full' ); //echo 'digital decor'; echo 'digital decor'; //hard coded echo '';


ChrisDrinkut commented 5 years ago

line 13 reads 'custom-log' -- guessing it should probably be 'custom-logo'. but, there's more to discerned with that snippet.

Here's a fix you can use.

https://developer.wordpress.org/themes/functionality/custom-logo/

from WP

I am able to use this guide from codex and can verify that within BlankSlate this setup works.

FIRST -- Add this to the functions.php file. add_theme_support( 'custom-logo' ); function themename_custom_logo_setup() { $defaults = array( 'height' => 100, 'width' => 400, 'flex-height' => true, 'flex-width' => true, 'header-text' => array( 'site-title', 'site-description' ), ); add_theme_support( 'custom-logo', $defaults ); } add_action( 'after_setup_theme', 'themename_custom_logo_setup' );

THEN -- Add this to the header.php file. <?php if ( function_exists( 'the_custom_logo' ) ) { the_custom_logo(); } ?>

Then use customize to load and publish.

artmelkon commented 5 years ago

Got it, and it works. Thank you

bhadaway commented 3 years ago

Hello,

Original creator of BlankSlate here. I'm sorry for the long hiatus, but I have been given permission to once again manage the project. So, I will again be pushing code updates and helping with user support.

Please let me know if you still need help with this specific issue and even if not, I would still like to get your feedback anyway:

https://github.com/tidythemes/blankslate/issues/23

Thanks!