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 | |
function insert_between_posts( $post ) { | |
global $wp_query; | |
// Check if we're in the right template | |
if ( ! is_home() ) | |
return; | |
// Check if we're in the main loop | |
if ( $wp_query->post != $post ) |
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_posts_columns', 'ws_cutom_columns_head', 20 ); | |
add_action( 'manage_posts_custom_column', 'ws_cutom_columns_content', 10, 2 ); | |
function ws_cutom_columns_head( $columns ) { | |
$columns['ws_post_id'] = 'ID'; | |
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
jQuery(document).ready(function($) { | |
var e = $(".mts-testimonial"), | |
t = $(".testimonials-authors li"), | |
f = $(".mts-testimonial:first"), | |
l = $(".testimonials-authors li:first"); | |
f.css({ | |
opacity: 1 | |
}); | |
l.addClass("active-testimonial"); | |
t.hover(function() { |
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 | |
$thumb_id = get_post_thumbnail_id(); | |
if ($thumb_id ) { | |
$thumb_url_array = wp_get_attachment_image_src($thumb_id, 'thumbnail-size', true); | |
$thumb_url = $thumb_url_array[0]; | |
} | |
?> |
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
<?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
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
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
<?php | |
header("HTTP/1.1 301 Moved Permanently"); | |
header("Location: ".get_bloginfo('url')); | |
exit(); | |
?> |