Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
06/21/2017 09:36:35 AM (7 years ago)
Author:
djpaul
Message:

Core: add template pack option to BuddyPress > Settings.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/admin/bp-core-admin-settings.php

    r10825 r11593  
    4646
    4747<?php
     48}
     49
     50/**
     51 * Form element to change the active template pack.
     52 */
     53function bp_admin_setting_callback_theme_package_id() {
     54    $options = '';
     55
     56    /*
     57     * Note: This should never be empty. /bp-templates/ is the
     58     * canonical backup if no other packages exist. If there's an error here,
     59     * something else is wrong.
     60     *
     61     * See BuddyPress::register_theme_packages()
     62     */
     63    foreach ( (array) buddypress()->theme_compat->packages as $id => $theme ) {
     64        $options .= sprintf(
     65            '<option value="%1$s" %2$s>%3$s</option>',
     66            esc_attr( $id ),
     67            selected( $theme->id, bp_get_theme_package_id(), false ),
     68            esc_html( $theme->name )
     69        );
     70    }
     71
     72    if ( $options ) : ?>
     73        <select name="_bp_theme_package_id" id="_bp_theme_package_id"><?php echo $options; ?></select>
     74        <p class="description"><label for="_bp_theme_package_id"><?php esc_html_e( 'The selected Template Pack will serve all BuddyPress templates.', 'buddypress' ); ?></label></p>
     75
     76    <?php else : ?>
     77        <p><?php esc_html_e( 'No template packages available.', 'buddypress' ); ?></p>
     78
     79    <?php endif;
    4880}
    4981
Note: See TracChangeset for help on using the changeset viewer.