Last active
December 10, 2023 22:34
-
-
Save richtabor/f044e3c56e18e141ceeb42915df3f556 to your computer and use it in GitHub Desktop.
Adding a custom logo to a WordPress theme's starter content.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Theme defaults and support for WordPress features. | |
*/ | |
function prefix_setup() { | |
/* | |
* Define starter content for the theme. | |
* See: https://make.wordpress.org/core/2016/11/30/starter-content-for-themes-in-4-7/ | |
*/ | |
$starter_content = array( | |
'attachments' => array( | |
'logo' => array( | |
'post_title' => _x( 'Logo', 'Theme starter content', 'prefix' ), | |
'file' => 'inc/customizer/images/logo.png', | |
), | |
), | |
'theme_mods' => array( | |
'custom_logo' => '{{logo}}', | |
), | |
); | |
/** | |
* Filters the theme's array of starter content. | |
* | |
* @param array $starter_content Array of starter content. | |
*/ | |
$starter_content = apply_filters( 'prefix_starter_content', $starter_content ); | |
add_theme_support( 'starter-content', $starter_content ); | |
} | |
add_action( 'after_setup_theme', 'prefix_setup' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello RichTabor,
Is it still works or supported? Unfortunately, it does not work (not fresh installation). Can you reccomend something for an existing site?
Thank you!