Making WordPress.org

Changeset 6971


Ignore:
Timestamp:
03/29/2018 03:32:25 PM (6 years ago)
Author:
Otto42
Message:

Main: About: Move hardcoded testimonial URLs to a page on the News blog, as a storage area for ease of maintaining

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-main/page-about-testimonials.php

    r6950 r6971  
    2525// See inc/page-meta-descriptions.php for the meta description for this page.
    2626
    27 /*
    28  * List of Twitter tweets to display in a random order.
    29  */
    30 $embed_tweets = array(
    31     'https://twitter.com/masonjames/status/690264022680231936',
    32     'https://twitter.com/rosso/status/690299171295748096',
    33     'https://twitter.com/thatmitchcanter/status/690300103312150529',
    34     'https://twitter.com/cesjam7/status/690302854213558273',
    35     'https://twitter.com/TomiToikka/status/690304183598211072',
    36     'https://twitter.com/takisbig/status/694654894398164992',
    37     'https://twitter.com/eatwholegrain/status/694510399971037184',
    38     'https://twitter.com/idylanrobertson/status/691375719532748800',
    39     'https://twitter.com/bobWP/status/708298319693479937',
    40 );
     27// Pull list of testimonial URLs from the news page holding them
     28switch_to_blog( 8 );
     29$testpage = get_page_by_path( 'testimonials' );
     30restore_current_blog();
    4131
    42 /*
    43  * List of WordPress embeds to mix into the content.
    44  *
    45  * Please Note: These must be the /embed link and must be https://
    46  */
    47 $embed_wps = array(
    48     'https://www.rhyswynne.co.uk/why-ilovewp/embed/',
    49     'https://ayudawp.com/ilovewp/embed/',
    50 );
     32// we only need the URLs in the post_content
     33preg_match_all( '|https://\S+|', $testpage->post_content, $testimonials );
     34$testimonials = $testimonials[0];
     35
     36// separate out the twiiter from the WPs
     37$embed_tweets = array_values( array_filter( $testimonials, function ($t) { return strpos( $t, 'https://twitter.com' ) === 0; } ) );
     38$embed_wps    = array_values( array_filter( $testimonials, function ($t) { return strpos( $t, 'https://twitter.com' ) !== 0; } ) );
    5139
    5240// Randomize the tweet order
Note: See TracChangeset for help on using the changeset viewer.