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( 'wp_enqueue_scripts', 'pt_like_it_scripts' ); | |
function pt_like_it_scripts() { | |
if( is_single() ) { | |
wp_enqueue_style( 'like-it', trailingslashit( plugin_dir_url( __FILE__ ) ).'css/like-it.css' ); | |
if (!wp_script_is( 'jquery', 'enqueued' )) { | |
wp_enqueue_script( 'jquery' );// Comment this line if you theme has already loaded jQuery | |
} | |
wp_enqueue_script( 'like-it', trailingslashit( plugin_dir_url( __FILE__ ) ).'js/like-it.js', array('jquery'), '1.0', true ); |
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=""> |
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 ).ready( function() { | |
/* === Checkbox Multiple Control === */ | |
jQuery( '.customize-control-checkbox-multiple input[type="checkbox"]' ).on( 'change', function() { | |
checkbox_values = jQuery( this ).parents( '.customize-control' ).find( 'input[type="checkbox"]:checked' ).map( | |
function() { | |
return this.value; | |
} |
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 | |
/**** | |
* 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
( function( $ ) { | |
$('#upload_form').on('submit', function(e){ | |
e.preventDefault(); | |
var $this = $(this), | |
nonce = $this.find('#image_upload_nonce').val(), | |
images_wrap = $('#images_wrap'), | |
status = $('#status'), | |
formdata = false; | |
if ( $this.find('#images').val() == '' ) { |
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', |
NewerOlder