File tree Expand file tree Collapse file tree 2 files changed +30
-3
lines changed Expand file tree Collapse file tree 2 files changed +30
-3
lines changed Original file line number Diff line number Diff line change @@ -354,6 +354,33 @@ function normalize_rosetta_items( $rosetta_items ) {
354
354
return $ normalized_items ;
355
355
}
356
356
357
+ /**
358
+ * Retrieve the URL of the home page.
359
+ *
360
+ * Most of the time it will just be `w.org/`, but Rosetta sites use the URL of the "root site" homepage.
361
+ */
362
+ function get_home_url () {
363
+ /** @var Rosetta_Sites $rosetta */
364
+ global $ rosetta ;
365
+
366
+ $ url = false ;
367
+
368
+ if ( is_rosetta_site () ) {
369
+ $ root_site = $ rosetta ->get_root_site_id ();
370
+ switch_to_blog ( $ root_site );
371
+
372
+ $ url = home_url ();
373
+
374
+ restore_current_blog ();
375
+ }
376
+
377
+ if ( ! $ url ) {
378
+ $ url = 'https://wordpress.org/ ' ;
379
+ }
380
+
381
+ return $ url ;
382
+ }
383
+
357
384
/**
358
385
* Retrieve the URL to download WordPress.
359
386
*
Original file line number Diff line number Diff line change 1
1
<?php
2
2
3
3
namespace WordPressdotorg \MU_Plugins \Global_Header_Footer \Header ;
4
- use function WordPressdotorg \MU_Plugins \Global_Header_Footer \{ get_download_url };
4
+ use function WordPressdotorg \MU_Plugins \Global_Header_Footer \{ get_home_url , get_download_url };
5
5
6
6
defined ( 'WPINC ' ) || die ();
7
7
18
18
<!-- The design calls for two logos, a small "mark" on mobile/tablet, and the full logo for desktops. -->
19
19
<!-- wp:image {"width":27,"height":27,"className":"global-header__wporg-logo-mark"} -->
20
20
<figure class="wp-block-image is-resized global-header__wporg-logo-mark">
21
- <a href="https://wordpress.org/ ">
21
+ <a href="<?php echo esc_url ( get_home_url () ); ?> ">
22
22
<img src="https://wordpress.org/style/images/w-mark.svg" alt="WordPress.org" width="27" height="27" />
23
23
</a>
24
24
</figure>
25
25
<!-- /wp:image -->
26
26
27
27
<!-- wp:image {"width":160,"height":24,"className":"global-header__wporg-logo-full"} -->
28
28
<figure class="wp-block-image is-resized global-header__wporg-logo-full">
29
- <a href="https://wordpress.org/ ">
29
+ <a href="<?php echo esc_url ( get_home_url () ); ?> ">
30
30
<img src="<?php echo plugin_dir_url ( __FILE__ ) . 'images/wporg-logo.svg ' ; ?> " alt="WordPress.org" width="160" height="24" />
31
31
</a>
32
32
</figure>
You can’t perform that action at this time.
0 commit comments