WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 2 years ago

#36877 new defect (bug)

Custom Logo default sizing inconsistencies

Reported by: ambrosey Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.5
Component: Customize Keywords: reporter-feedback
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 (2)

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


2 years ago

#2 @ocean90
2 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?

Note: See TracTickets for help on using tickets.