WordPress.org

Make WordPress Core

Opened 5 years ago

Last modified 4 months ago

#36877 new defect (bug)

Custom Logo default sizing inconsistencies

Reported by: ambrosey Owned by:
Milestone: Awaiting Review Priority: low
Severity: normal Version: 4.5
Component: Customize Keywords: reporter-feedback close
Focuses: Cc:

Description (last modified by ocean90)

Per a discussion on #docs with @parsmizban , it appears that default use of

add_theme_support('custom_logo');

without extra arguments should pass null values for height and width, and true values for flex width and flex height given wp-includes/theme.php

case 'custom-logo':
                        if ( ! is_array( $args ) ) {
                                $args = array( 0 => array() );
                        }
                        $defaults = array(
                                'width'       => null,
                                'height'      => null,
                                'flex-width'  => false,
                                'flex-height' => false,
                                'header-text' => '',
                        );
                        $args[0] = wp_parse_args( array_intersect_key( $args[0], $defaults ), $defaults );
                        // Allow full flexibility if no size is specified.
                        if ( is_null( $args[0]['width'] ) && is_null( $args[0]['height'] ) ) {
                                $args[0]['flex-width']  = true;
                                $args[0]['flex-height'] = true;
                        }
                        break;

however, given

/wp-includes/customize/class-wp-customize-cropped-image-control.php

<?php
        /**
         * Suggested width for cropped image.
         *
         * @since 4.3.0
         * @access public
         * @var int
         */
        public $width = 150;
        /**
         * Suggested height for cropped image.
         *
         * @since 4.3.0
         * @access public
         * @var int
         */
        public $height = 150;

it is acting as 150px x 150px for the passed height and width. Is this intentional behavior? Should the suggested size actually be coming through for custom logo? Cropping is working as flex width and height, so it's only the "displayed" suggested size that is in question.

https://wordpress.slack.com/archives/docs/p1463577732000750

To reproduce: new install of WordPress, install TwentySixteen with edited functions.php file to remove array parameter on line 72.

Change History (3)

This ticket was mentioned in Slack in #docs by ambrosey. View the logs.


5 years ago

#2 @ocean90
5 years ago

  • Description modified (diff)
  • Keywords reporter-feedback added
  • Version changed from trunk to 4.5

Hello @ambrosey, welcome to our Trac!

so it's only the "displayed" suggested size that is in question.

Can you explain what you mean by that?

#3 @celloexpressions
4 months ago

  • Keywords close added
  • Milestone set to Awaiting Review
  • Priority changed from normal to low

As long as flex-width and flex-height are correctly enabled, the default sizes will only be used as "suggested" text and potentially initial crop during the cropping step. There could be a relatively minor adjustment here to try to align this behavior with the defaults or we could leave it as-is since the issue is low-impact.

Note: See TracTickets for help on using tickets.