Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#36327 closed defect (bug) (fixed)

Custom logo: the image size argument is not taking in account

Reported by: imath's profile imath Owned by: obenland's profile obenland
Milestone: 4.5 Priority: normal
Severity: normal Version: 4.6
Component: Themes Keywords: has-patch commit
Focuses: Cc:

Description

In this post on Make.WP.org

you explain we can set/get the image size of the custom logo this way :

add_image_size( 'theme-prefix-logo', 400, 175 );
add_theme_support( 'custom-logo', array(
   'size' => 'theme-prefix-logo',
) );

Unfortunately it's not working anymore, the size argument is not kept in the add_theme_support() function. As a result, the full size is always output. It looks like adding the size arguments to the defaults one is fixing the issue.

See suggested patch, attached to this ticket.

Attachments (2)

36327.patch (375 bytes) - added by imath 9 years ago.
36327.diff (2.9 KB) - added by ocean90 9 years ago.

Download all attachments as: .zip

Change History (12)

@imath
9 years ago

#1 @imath
9 years ago

  • Keywords has-patch added

#2 @DrewAPicture
9 years ago

  • Keywords dev-feedback added
  • Milestone changed from Awaiting Review to 4.5
  • Owner set to obenland
  • Status changed from new to assigned

#3 @ocean90
9 years ago

It seems like the make/core post isn't updated yet to reflect the changes in [37077].

#4 @obenland
9 years ago

  • Keywords dev-feedback removed
  • Milestone 4.5 deleted
  • Resolution set to invalid
  • Status changed from assigned to closed

I updated the post to reflect the new arguments and added a paragraph to explain the change:

[EDIT]: As of [37077], Custom Logo does not support the size argument anymore. Specifying the logo size in individual arguments has the advantage of only creating a special image file for the specific logo used (and not every image uploaded), and providing more parity with how Custom Header works.

#5 @imath
9 years ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

@obenland @ocean90

Fine, but then why using get_theme_support( 'custom-logo', 'size' ); in the function get_custom_logo() as it's not possible to specify this size with add_theme_support() anymore ??

see https://core.trac.wordpress.org/browser/trunk/src/wp-includes/general-template.php#L879

It seems weird to me to use a function that can't return anything set by the theme....

So to be consistent i think you should allow the size argument or remove this get_theme_support( 'custom-logo', 'size' ); part...

#6 @ocean90
9 years ago

  • Milestone set to 4.5

36327.diff removes the $size reference from get_custom_logo().

@ocean90
9 years ago

#7 @obenland
9 years ago

  • Keywords commit added

This ticket was mentioned in Slack in #core by mike. View the logs.


9 years ago

#10 @obenland
9 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 37135:

Template: Remove $size reference from get_custom_logo().

Argument was removed in [37077] in favor of with and height arguments.

Props ocean90.
Fixes #36327.

Note: See TracTickets for help on using tickets.