Skip to:
Content

BuddyPress.org

Changeset 10610


Ignore:
Timestamp:
02/17/2016 10:22:06 PM (9 years ago)
Author:
r-a-y
Message:

Emails: Change 'Excerpt' metabox to custom 'Plain text email content' metabox.

The 'Excerpt' metabox doesn't describe what we are using it for with our
BP email custom post type.

Unfortunately, to alter the default 'Excerpt' metabox, we need to
completely remove it and re-add the metabox to use our custom strings.

Props DJPaul.

Fixes #6918.

Location:
trunk/src/bp-core/admin
Files:
3 edited

Legend:

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

    r10565 r10610  
    900900
    901901/**
     902 * Custom metaboxes used by our 'bp-email' post type.
     903 *
     904 * @since 2.5.0
     905 */
     906function bp_email_custom_metaboxes() {
     907    // Remove default 'Excerpt' metabox and replace with our own.
     908    remove_meta_box( 'postexcerpt', null, 'normal' );
     909    add_meta_box( 'postexcerpt', __( 'Plain text email content', 'buddypress' ), 'bp_email_plaintext_metabox', null, 'normal', 'high' );
     910}
     911add_action( 'add_meta_boxes_' . bp_get_email_post_type(), 'bp_email_custom_metaboxes' );
     912
     913/**
     914 * Customized version of the 'Excerpt' metabox for our 'bp-email' post type.
     915 *
     916 * We are using the 'Excerpt' metabox as our plain-text email content editor.
     917 *
     918 * @since 2.5.0
     919 *
     920 * @param WP_Post $post
     921 */
     922function bp_email_plaintext_metabox( $post ) {
     923?>
     924
     925    <label class="screen-reader-text" for="excerpt"><?php _e( 'Plain text email content', 'buddypress' ); ?></label><textarea rows="5" cols="40" name="excerpt" id="excerpt"><?php echo $post->post_excerpt; // textarea_escaped ?></textarea>
     926
     927    <p><?php _e( 'Most email clients support HTML email. However, some people prefer to receive plain text email. Enter a plain text alternative version of your email here.', 'buddypress' ); ?></p>
     928
     929<?php
     930}
     931
     932/**
    902933 * Restrict various items from view if editing a BuddyPress menu.
    903934 *
  • trunk/src/bp-core/admin/css/common-rtl.css

    r10465 r10610  
    279279    }
    280280}
     281
     282/* Emails - Edit page */
     283body.post-type-bp-email #excerpt {
     284    height: auto;
     285}
  • trunk/src/bp-core/admin/css/common.css

    r10465 r10610  
    279279    }
    280280}
     281
     282/* Emails - Edit page */
     283body.post-type-bp-email #excerpt {
     284    height: auto;
     285}
Note: See TracChangeset for help on using the changeset viewer.