Skip to content

Instantly share code, notes, and snippets.

@richtabor
Last active December 10, 2023 22:34
Show Gist options
  • Save richtabor/f044e3c56e18e141ceeb42915df3f556 to your computer and use it in GitHub Desktop.
Save richtabor/f044e3c56e18e141ceeb42915df3f556 to your computer and use it in GitHub Desktop.
Adding a custom logo to a WordPress theme's starter content.
<?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' );
@foldesistudio
Copy link

foldesistudio commented Dec 10, 2023

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment