This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'wp_mail_from', 'baw_fix_wp_474_mail_reset_vulnerability' ); | |
function baw_fix_wp_474_mail_reset_vulnerability( $from_email ) { | |
return 'wordpress@example.com'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'embed_site_title_html', 'baw_embed_site_title' ); | |
function baw_embed_site_title( $title ) { | |
return '<a href="http://wpsolo.fr" target="_top"><img src="/wp-content/uploads/2011/07/iMovie-Logo.png" width="32" height="32" alt="" class="wp-embed-site-icon"><span>MyMovies</span></a>'; | |
} | |
add_action( 'embed_content', 'baw_embed_content' ); | |
function baw_embed_content() { | |
echo '<i>Rating</i>: ' . str_repeat( '★', 5 ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'the_title', 'baw_add_color_to_title' ); | |
function baw_add_color_to_title( $title ) { | |
global $post; | |
if ( is_single() ) { | |
$term = get_the_terms( 0, 'category' ); | |
if ( $term ) { | |
$term = reset( $term ); | |
$color = get_term_meta( $term->term_id, 'color', true ); | |
$title = sprintf( '<span style="color:%s">%s</span>', esc_attr( $color ), $title ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'edit_category', 'baw_save_term_color' ); | |
add_action( 'create_category', 'baw_save_term_color' ); | |
function baw_save_term_color( $term_id ) { | |
if ( defined( 'DOING_AJAX' ) ) { | |
return; | |
} | |
if ( ! isset( $_POST['add_term_meta_color_nonce'] ) || | |
! isset( $_POST['baw_term_color'] ) || | |
! wp_verify_nonce( $_POST['add_term_meta_color_nonce'], 'add_term_meta_color' ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'category_add_form_fields', 'baw_new_term_color_field' ); | |
function baw_new_term_color_field() { | |
wp_nonce_field( 'add_term_meta_color', 'add_term_meta_color_nonce' ); | |
?> | |
<div class="form-field"> | |
<label for="baw_term_color"><?php _e( 'Front Color', 'baw' ); ?></label> | |
<input type="text" name="baw_term_color" id="baw_term_color" data-default-color="#FFFFFF" value="#FFFFFF" /> | |
</div> | |
<?php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'pre_get_imagify_option_admin_bar_menu', 'imagify_admin_bar_for_admins' ); | |
function imagify_admin_bar_for_admins() { | |
return current_user_can( 'manage_options' ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'manage_edit-category_columns', 'baw_edit_term_columns' ); | |
function baw_edit_term_columns( $columns ) { | |
$columns['color'] = __( 'Front Color', 'baw' ); | |
return $columns; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'admin_head-edit-tags.php', 'baw_admin_enqueue_styles' ); | |
function baw_admin_enqueue_styles() { | |
global $taxnow; | |
if ( 'category' != $taxnow ) { | |
return; | |
} | |
add_action( 'admin_head', 'baw_term_colors_print_styles' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'admin_head-edit-tags.php', 'baw_admin_enqueue_scripts' ); | |
function baw_admin_enqueue_scripts() { | |
global $taxnow; | |
if ( 'category' != $taxnow ) { | |
return; | |
} | |
wp_enqueue_style( 'wp-color-picker' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'category_add_form_fields', 'baw_new_term_color_field' ); | |
function baw_new_term_color_field() { | |
wp_nonce_field( 'add_term_meta_color', 'add_term_meta_color_nonce' ); | |
?> | |
<div class="form-field"> | |
<label for="baw_term_color"><?php _e( 'Front Color', 'baw' ); ?></label> | |
<input type="text" name="baw_term_color" id="baw_term_color" data-default-color="#ffffff" /> | |
</div> | |
<?php |