mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Customize: Only add custom logo’s header text control if needed.
Dissolves `WP_CustomLogo` and adopts a structure similar to custom header and background (See `_delete_attachment_theme_mod()`).
The option to hide header text only gets added if it’s not already part of custom header, and only if selectors have been registered when theme support for custom logos was declared. Themes can add `postMessage` support for it as well.
Example:
{{{
add_theme_support( 'custom-logo', array(
'size' => ‘large’,
'header-text' => array( 'site-title', 'site-description' ),
) );
}}}
See #33755.
git-svn-id: https://develop.svn.wordpress.org/trunk@36915 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1,45 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Tests for the WP_Custom_logo class.
|
||||
*
|
||||
* @group custom_logo
|
||||
*/
|
||||
class Tests_WP_Custom_Logo extends WP_UnitTestCase {
|
||||
public $attachment_id = 0;
|
||||
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
require_once ABSPATH . 'wp-admin/includes/class-wp-custom-logo.php';
|
||||
}
|
||||
|
||||
function tearDown() {
|
||||
$this->custom_logo = null;
|
||||
$this->remove_added_uploads();
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
function test_delete_attachment_data() {
|
||||
$attachment_id = $this->_insert_attachment();
|
||||
set_theme_mod( 'custom_logo', $attachment_id );
|
||||
|
||||
wp_delete_attachment( $attachment_id, true );
|
||||
|
||||
$this->assertFalse( get_theme_mod( 'custom_logo' ) );
|
||||
}
|
||||
|
||||
function _insert_attachment() {
|
||||
if ( $this->attachment_id ) {
|
||||
return $this->attachment_id;
|
||||
}
|
||||
|
||||
$filename = DIR_TESTDATA . '/images/test-image.jpg';
|
||||
$contents = file_get_contents( $filename );
|
||||
|
||||
$upload = wp_upload_bits( basename( $filename ), null, $contents );
|
||||
|
||||
$this->attachment_id = $this->_make_attachment( $upload );
|
||||
return $this->attachment_id;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user