Making WordPress.org

Changeset 1143


Ignore:
Timestamp:
01/14/2015 11:35:51 PM (10 years ago)
Author:
iandunn
Message:

Central Theme: Link to a camp's page on Central if they don't have a website.

r1110 changed the template to link directly to the site, but some of the older camps don't have a URL set, so we need to fall back to their Central page.

Location:
sites/trunk/wordcamp.org/public_html/wp-content/themes/wordcamp-central-2012
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/themes/wordcamp-central-2012/functions.php

    r1142 r1143  
    628628        return $grouped_wordcamps;
    629629    }
     630
     631    /**
     632     * Returns a WordCamp's website URL if it's available, or their Central page if is isn't.
     633     *
     634     * @param int $post_id
     635     *
     636     * @return string
     637     */
     638    public static function get_best_wordcamp_url( $post_id = 0 ) {
     639        $url = wcpt_get_wordcamp_url( $post_id );
     640
     641        if ( ! filter_var( $url, FILTER_VALIDATE_URL ) ) {
     642            $url = wcpt_get_wordcamp_permalink( $post_id );
     643        }
     644
     645        return $url;
     646    }
    630647}
    631648
  • sites/trunk/wordcamp.org/public_html/wp-content/themes/wordcamp-central-2012/template-past-wordcamps.php

    r1129 r1143  
    4848
    4949                                <li>
    50                                     <a href="<?php echo esc_url( wcpt_get_wordcamp_url( $post->ID ) ); ?>">
     50                                    <a href="<?php echo esc_url( WordCamp_Central_Theme::get_best_wordcamp_url( $post->ID ) ); ?>">
    5151                                        <?php if ( has_post_thumbnail() ) : ?>
    5252                                            <?php the_post_thumbnail( 'wccentral-thumbnail-past', array( 'class' => 'wc-image' ) ); ?>
Note: See TracChangeset for help on using the changeset viewer.