Skip to content

Instantly share code, notes, and snippets.

@imath
Created January 12, 2015 20:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imath/8afc70a43318d306c711 to your computer and use it in GitHub Desktop.
Save imath/8afc70a43318d306c711 to your computer and use it in GitHub Desktop.
Override template notices
<?php
function slaffik_render_message() {
// Get BuddyPress
$bp = buddypress();
if ( ! empty( $bp->template_message ) ) :
$type = ( 'success' === $bp->template_message_type ) ? 'updated' : 'error';
$content = apply_filters( 'bp_core_render_message_content', $bp->template_message, $type ); ?>
<div id="message" class="slaffik-notice <?php echo esc_attr( $type ); ?>">
<?php echo $content; ?>
</div>
<?php
do_action( 'bp_core_render_message' );
endif;
}
function slaffik_remove_bp_core_render_message() {
remove_action( 'template_notices', 'bp_core_render_message' );
add_action( 'template_notices', 'slaffik_render_message' );
}
add_action( 'bp_actions', 'slaffik_remove_bp_core_render_message', 6 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment