add_action('add_meta_boxes', function() { add_meta_box( 'custom-logo-metabox', 'Custom Logo', function($post) { // Add a nonce field so we can check for it later wp_nonce_field('custom_logo_meta_box', 'custom_logo_meta_box_nonce'); // Retrieve the existing value from the database $custom_logo_id = get_post_meta($post->ID, '_custom_logo_id', true); $custom_logo_url = $custom_logo_id ? wp_get_attachment_image_url($custom_logo_id, 'thumbnail') : ''; // Output the form fields echo '
'; echo ''; echo ''; echo ''; echo ''; echo '
'; // Add a script to handle the media uploader ?> '; } } } return $html; }); add_filter('get_site_icon_url', function($url, $size, $blog_id) { if (is_page()) { // Get the current page's ID $post_id = get_the_ID(); // Retrieve the custom logo URL from post meta $custom_logo_id = get_post_meta($post_id, '_custom_logo_id', true); if ($custom_logo_id) { $custom_logo_url = wp_get_attachment_image_url($custom_logo_id, array($size, $size)); if ($custom_logo_url) { return $custom_logo_url; } } } return $url; }, 10, 3);

Weißer Burgunder