This file contains hidden or 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 strip_html_tags( $text ) | |
{ | |
$text = preg_replace( | |
array( | |
// Remove invisible content | |
'@<head[^>]*?>.*?</head>@siu', | |
'@<style[^>]*?>.*?</style>@siu', | |
'@<script[^>]*?.*?</script>@siu', | |
'@<object[^>]*?.*?</object>@siu', | |
'@<embed[^>]*?.*?</embed>@siu', |
This file contains hidden or 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
// check autosave | |
if ( (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) || ( defined('DOING_AJAX') && DOING_AJAX) || isset($_REQUEST['bulk_edit']) ) return $post_id |
This file contains hidden or 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
//MENU HOVER ON TOUCH-able DEVICE | |
if( 'ontouchstart' in document.documentElement ){ | |
var clickable = null; | |
$('.touchable').each(function(){ | |
var $this = $(this); | |
if( $this.find('ul.sub-menu').length > 0 ){ | |
$this.find('a:first').unbind('click').bind('touchstart',function(event){ | |
if( clickable != this ){ |
This file contains hidden or 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
//Trick allow user subscriber can edit comment | |
function nex_update_cap($allcaps){ | |
//print_r($allcaps); | |
global $comment; | |
if( !empty($comment) ){ | |
global $current_user; | |
if( $current_user->ID == $comment->user_id ){ | |
$allcaps['edit_others_posts'] = 1; | |
$allcaps['edit_published_posts'] = 1; |
This file contains hidden or 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
/*-----------------------------------------------------------------------------------*/ | |
/* Get newest post day of each category | |
/*-----------------------------------------------------------------------------------*/ | |
if ( !function_exists( 'wallpress_is_new_post' ) ) : | |
function wallpress_is_new_post( $post_id ) { | |
//Get newest point of time of each category, must be newest and lessthan 3 days | |
$categories = get_the_category( $post_id ); | |
foreach ( $categories as $category ) { | |
$date = wallpress_newest_post_category( $category->cat_ID ); | |
$post_date = get_the_time( 'Y-m-d', $post_id ); |
This file contains hidden or 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 rb_add_role( $allcaps, $caps, $args ){ | |
global $post; | |
if( 'edit_comment' == $args[0] ) { | |
foreach ($caps as $cap) { | |
if( ! array_key_exists($cap, $allcaps) ) { | |
$allcaps[$cap] = 1; | |
} | |
} | |
} | |
return $allcaps; |
This file contains hidden or 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
var ondrag = false, | |
pointStart = lastPoint = distance = currentTranslate = 0; | |
$(window).on('mousedown mousemove mouseup touchmove touchstart touchend',function(event){ | |
console.log( event ); | |
switch(event.type) { | |
case 'touchstart': | |
case 'mousedown': | |
ondrag = true; | |
pointStart = lastPoint = event.pageX || event.originalEvent.touches[0].pageX; | |
break; |
This file contains hidden or 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
<div id="rb-follow-button"></div> | |
<script> | |
window.twttr = (function (d,s,id) { | |
var t, js, fjs = d.getElementsByTagName(s)[0]; | |
if (d.getElementById(id)) return; js=d.createElement(s); js.id=id; | |
js.src="https://platform.twitter.com/widgets.js"; fjs.parentNode.insertBefore(js, fjs); | |
return window.twttr || (t = { _e: [], ready: function(f){ t._e.push(f) } }); | |
}(document, "script", "twitter-wjs")); | |
twttr.ready(function(twttr){ |
This file contains hidden or 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
/** Estimate Reading Time | |
*----------------*/ | |
if( !function_exists('rb_timeline_eta') ) { | |
function rb_timeline_eta(){ | |
global $post; | |
$words_per_minute = 270; | |
$words_per_second = $words_per_minute / 60; | |
$post_content = $post->post_content; | |
$word_count = str_word_count(strip_tags($post_content)); |