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', 'ccp_new_term_color_field' ); | |
function ccp_new_term_color_field() { | |
wp_nonce_field( basename( __FILE__ ), 'jt_term_color_nonce' ); ?> | |
<div class="form-field jt-term-color-wrap"> | |
<label for="jt-term-color"><?php _e( 'Color', 'jt' ); ?></label> | |
<input type="text" name="jt_term_color" id="jt-term-color" value="" class="jt-color-field" data-default-color="#ffffff" /> |
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 | |
/** | |
* Print an extra field into the login form | |
* | |
* @link https://codex.wordpress.org/Plugin_API/Action_Reference/login_form | |
*/ | |
function my_login_extra_field() { | |
?> | |
<p> | |
<label for="rd"><?php _e( 'Take me to' ); ?></label> |
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('display_post_states', 'wpsites_custom_post_states'); | |
function wpsites_custom_post_states($states) { | |
global $post; | |
if( ('page'==get_post_type($post->ID)) && ('page-templates/custom-page-template.php'==get_page_template_slug($post->ID)) ) { | |
$states[] = __('Custom state'); | |
} | |
} |
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 | |
header("HTTP/1.1 301 Moved Permanently"); | |
header("Location: ".get_bloginfo('url')); | |
exit(); | |
?> |
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
jQuery( document ).on( 'click', '.pt-tax-like-it', function() { | |
var $this = jQuery(this), | |
id = jQuery(this).find('.like-button').attr('data-id'), | |
nonce = jQuery(this).find('.like-button').attr("data-nonce"); | |
jQuery.ajax({ | |
url : taxlikeit.ajax_url, | |
type : 'post', | |
data : { | |
action : 'pt_tax_like_it', |
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_authenticate', 'wpsites_no_admin_user' ); | |
function wpsites_no_admin_user($user){ | |
if($user == 'admin'){ | |
exit; | |
} | |
} | |
add_filter('sanitize_user', 'wpsites_sanitize_user_no_admin',10,3); | |
function wpsites_sanitize_user_no_admin($username, $raw_username, $strict){ | |
if($raw_username == 'admin' || $username == 'admin'){ |
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 | |
/**** | |
* Automatic Linking to Twitter Usernames within a post | |
****/ | |
function content_twitter_mention($content) { | |
return preg_replace('/([^a-zA-Z0-9-_&])@([0-9a-zA-Z_]+)/', "$1@$2", $content); | |
} | |
add_filter('the_content', 'content_twitter_mention'); | |
add_filter('comment_text', 'content_twitter_mention'); |
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 the field to the Add New Category page | |
add_action( 'category_add_form_fields', 'pt_taxonomy_add_new_meta_field', 10, 2 ); | |
function pt_taxonomy_add_new_meta_field() { | |
// this will add the custom meta field to the add new term page | |
?> | |
<div class="form-field"> | |
<label for="term_meta[cat_icon]"><?php _e( 'Font Awesome Icons', 'pt' ); ?></label> | |
<input type="text" name="term_meta[cat_icon]" id="term_meta[cat_icon]" value=""> |