Making WordPress.org


Ignore:
Timestamp:
06/29/2018 02:51:26 PM (6 years ago)
Author:
obenland
Message:

Main: Add download to list of download slugs

Makes for a better experience on sites that don't use the txt-download slug.

File:
1 edited

Legend:

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

    r6277 r7349  
    3333 * Retrieve the localised downloads link.
    3434 *
    35  * Uses the 'txt-download' page if exists, falling back to the 'releases' page for older sites, and finally, the english downloads page.
     35 * Uses the 'txt-download' page if exists, falling back to the 'releases' page for older sites,
     36 * and finally, the english downloads page.
    3637 */
    3738function get_downloads_url() {
     
    3940
    4041    if ( is_null( $downloads_url ) ) {
    41         $releases_page = get_page_by_path( 'txt-download' );
     42        $downloads_url  = 'https://wordpress.org/downloads/';
     43        $downloads_page = get_page_by_path( 'txt-download' );
    4244
    43         if ( ! $releases_page ) {
    44             $releases_page = get_page_by_path( 'releases' );
     45        if ( ! $downloads_page ) {
     46            $downloads_page = get_page_by_path( 'download' );
    4547        }
    4648
    47         if ( $releases_page ) {
    48             $downloads_url = get_permalink( $releases_page );
     49        if ( ! $downloads_page ) {
     50            $downloads_page = get_page_by_path( 'releases' );
    4951        }
    5052
    51         if ( ! $downloads_url ) {
    52             $downloads_url = 'https://wordpress.org/downloads/';
     53        if ( $downloads_page ) {
     54            $downloads_url = get_permalink( $downloads_page );
    5355        }
    5456    }
Note: See TracChangeset for help on using the changeset viewer.