-
Notifications
You must be signed in to change notification settings - Fork 798
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
Remove PHP Notice when there is no logo an we are looking for an logo ID #14924
Conversation
Caution: This PR has changes that must be merged to WordPress.com |
Thank you for the great PR description! When this PR is ready for review, please apply the Scheduled Jetpack release: April 7, 2020. |
@@ -103,7 +103,7 @@ function jetpack_has_site_logo() { | |||
function jetpack_the_site_logo() { | |||
$logo = site_logo()->logo; | |||
$logo_id = get_theme_mod( 'custom_logo' ); // Check for WP 4.5 Site Logo | |||
$logo_id = $logo_id ? $logo_id : $logo['id']; // Use WP Core logo if present, otherwise use Jetpack's. | |||
$logo_id = $logo_id ? $logo_id : ( isset( $logo['id'] ) ? $logo['id'] : false ); // Use WP Core logo if present, otherwise use Jetpack's. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this is false
should we better handle the $html
at line 123 instead of passing false
to wp_get_attachment_image
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way I understand we never be passing false
to wp_get_attachment_image
.
Since it would be caught in ( ! jetpack_has_site_logo() ) check and we are not suing the $logo_id
in that block.
And keep $html as '';
Howdy! The Jetpack team has disappeared for a few days to a secret island lair to concoct new ways to make Jetpack one hundred billion percent better. As a result, your Pull Request may not be reviewed right away. Do not worry, we will be back next week to look at your work! Thank you for your understanding. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't really reproduce the issue. I never see the NOTICE. Anyway the PR looks good.
Just one question:
Why do we check for jetpack_has_site_logo()
and not for $logo_id
here?
if ( ! jetpack_has_site_logo() ) { |
$logo_id
is looking at get_theme_mod( 'custom_logo' )
, while jetpack_has_site_logo()
is looking for get_option( 'site_logo', null )
.
enejb, Your synced wpcom patch D40052-code has been updated. |
Sorry, I couldn't help myself. The logic in the function seemed very strange to me, so I decided to refactor it a bit, and pushed one more commit to this PR. Here's how you can test it.
Essentially this is a very crude way of adding a logo to your header. This also enables the Customizer entry inside the
|
Oh, one more thing. @leogermani you were asking why we're checking |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the clarification @zinigor and for the extended testing instructions.
I can confirm the fix.
The logic is much more readable now as well!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be good to merge!
@enejb I'll let you handle the matching wpcom diff? D40052-code. Thank you! |
Committed it via r204773-wpcom to avoid it getting stale. cc: @enejb |
* Initial changelog entry * Changelog: add #14904 * Changelog: add #14910 * Changelog: add #14913 * Changelog: add #14916 * Changelog: add #14922 * Changelog: add #14924 * Changelog: add #14925 * Changelog: add #14928 * Changelog: add #14840 * Changelog: add #14841 * Changelog: add #14842 * Changelog: add #14826 * Changelog: add #14835 * Changelog: add #14859 * Changelog: add #14884 * Changelog: add #14888 * Changelog: add #14817 * Changelog: add #14814 * Changelog: add #14819 * Changelog;: add #14797 * Changelog: add #14798 * Changelog: add #14802 * Changelog: add #13676 * Changelog: add #13744 * Changelog: add #13777 * Changelog: add #14446 * Changelog: add #14739 * Changelog: add #14770 * Changelog: add #14784 * Changelog: add #14897 * Changelog: add #14898 * Changelog: add #14968 * Changelog: add #14985 * Changelog: add #15044 * Changelog: add #15052 * Update to remove Podcast since it remains in Beta * Changelog: add #14803 * Changelog: add #15028 * Changelog: add #15065 * Changelog:add #14886 * Changelog: add #15118 * Changelog: add #14990 * Changelog: add #14528 * Changelog: add #15120 * Changelog: add #15126 * Changelog: add #15049 * Chanegelog: add #14852 * Changelog: add #15090 * Changelog: add #15138 * Changelog: add #15124 * Changelog:add #15055 * Changelog: add #15017 * Changelog: add #15109 * Changelog: add #15145 * Changelog:add #15096 * Changelog:add #15153 * Changelog: add #15133 * Changelog: add #14960 * Changelog: add #15127 * Changelog: add #15056 * Copy current changelog to changelog archive. * Clarify changelog description
Fixes #14747
Changes proposed in this Pull Request:
Testing instructions:
Proposed changelog entry for your changes: