'slugs' ) ); // If the post has categories, check if the widget ID matches any of them if ( ! empty( $post_categories ) ) { foreach ( $post_categories as $slug ) { // If the widget ID contains the category slug (e.g. widget ID 'music' matches slug 'music') if ( strpos( $widget->id, $slug ) !== false || $widget->id === $slug ) { return $instance; // FORCE SHOW the matching logo widget } } } } // 2. If we are on a standard category archive page (like the main music page) if ( is_category() ) { $current_archive_cat = get_queried_object()->slug; // If the widget ID matches this category archive, show it if ( strpos( $widget->id, $current_archive_cat ) !== false || $widget->id === $current_archive_cat ) { return $instance; } } // Pass everything else through normally so Widget Options can handle the rest return $instance; }