Making WordPress.org


Ignore:
Timestamp:
04/03/2015 01:01:47 PM (10 years ago)
Author:
djpaul
Message:

BuddyPress.org/bbPress.org: replace hardcoded URLs with convenience functions for redirects and CSS loading.

These themes can now easily be run on a local dev environment. Until this change, you’ve had to use buddypress.org or bbpress.org (etc) as the domain name for your dev site. This is because the themes had a number of hardcoded redirects and URL detection which assumed the production URLs would always be used.

The change updates the redirects to use home_url, and creates new (filtered) wrapper functions used to determine if the theme is running on buddypress.org or bbpress.org.
This will help integrate the “bb” sites into https://github.com/iandunn/wordpress-meta-environment/.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/buddypress.org/public_html/wp-content/themes/bb-base/functions.php

    r1263 r1468  
    2323}
    2424
     25/**
     26 * Are we looking at a buddypress.org site?
     27 *
     28 * @return bool
     29 */
     30function bb_base_is_buddypress() {
     31    $retval = (bool) strstr( $_SERVER['HTTP_HOST'], 'buddypress' );
     32    return (bool) apply_filters( 'bb_base_is_buddypress', $retval );
     33}
     34
     35/**
     36 * Are we looking at a bbpress.org site?
     37 *
     38 * @return bool
     39 */
     40function bb_base_is_bbpress() {
     41    $retval = (bool) strstr( $_SERVER['HTTP_HOST'], 'bbpress' );
     42    return (bool) apply_filters( 'bb_base_is_bbpress', $retval );
     43}
     44
     45
    2546// Include in Codex code on codex sites
    2647if ( bb_base_is_codex() ) {
     
    4061
    4162    // Handle root styling for buddypress/bbpress
    42     if ( strstr( $_SERVER['HTTP_HOST'], 'bbpress.org' ) ) {
     63    if ( bb_base_is_bbpress() ) {
    4364        $root = 'style-bbpress.css';
    44     } elseif ( strstr( $_SERVER['HTTP_HOST'], 'buddypress.org' ) ) {
     65    } elseif ( bb_base_is_buddypress() ) {
    4566        $root = 'style-buddypress.css';
    4667    }
Note: See TracChangeset for help on using the changeset viewer.