Making WordPress.org


Ignore:
Timestamp:
11/09/2017 02:21:13 AM (8 years ago)
Author:
dd32
Message:

Main: Determine URLs for main pages which we know exist on Rosetta sites, avoiding the need to translate the URLs.

Ammends r6096.
See #2861.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-main/inc/template-tags.php

    r6091 r6098  
    5353    <?php
    5454}
     55
     56/**
     57 * Rerieve the localised downloads link.
     58 *
     59 * Uses the 'releases' page if exists, falling back to the 'txt-download' page for older sites, and finally, the english downloads page.
     60 */
     61function get_downloads_url() {
     62    static $downloads_url = null;
     63    if ( is_null( $downloads_url ) ) {
     64        $releases_page = get_page_by_path( 'releases' );
     65        if ( ! $releases_page ) {
     66            $releases_page = get_page_by_path( 'txt-download' );
     67        }
     68
     69        if ( $releases_page ) {
     70            $downloads_url = get_permalink( $releases_page );
     71        }
     72        if ( ! $downloads_url ) {
     73            $downloads_url = 'https://wordpress.org/downloads/';
     74        }
     75    }
     76    return $downloads_url;
     77}
Note: See TracChangeset for help on using the changeset viewer.