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 Next Page/Page Break Button | |
* in WordPress Visual Editor | |
*/ | |
function my_add_next_page_button( $buttons, $id ){ | |
/* only add this for content editor */ | |
if ( 'content' != $id ) | |
return $buttons; |
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 | |
// If it's the blog | |
function is_blog() { | |
global $post; | |
$posttype = get_post_type( $post ); | |
return ( ( ( is_archive() ) || ( is_author() ) || ( is_category() ) || ( is_home() ) || ( is_single() ) || ( is_tag() ) || ( is_search() ) ) && ( $posttype == 'post' ) ) ? true : false; | |
} | |
?> |
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 hatom data | |
function add_suf_hatom_data($content) { | |
$t = get_the_modified_time('F jS, Y'); | |
$author = get_the_author(); | |
$title = get_the_title(); | |
if (is_home() || is_singular() || is_archive() ) { | |
$content .= '<div class="hatom-extra" style="display:none;visibility:hidden;"><span class="entry-title">'.$title.'</span> was last modified: <span class="updated"> '.$t.'</span> by <span class="author vcard"><span class="fn">'.$author.'</span></span></div>'; | |
} | |
return $content; |
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 move_comment_field( $fields ) { | |
$comment_field = $fields['comment']; | |
unset( $fields['comment'] ); | |
$fields['comment'] = $comment_field; | |
return $fields; | |
} | |
add_filter( 'comment_form_fields', 'move_comment_field' ); | |
?> |
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 keep_my_links($text) { | |
global $post; | |
if ( '' == $text ) { | |
$text = get_the_content(''); | |
$text = apply_filters('the_content', $text); | |
$text = str_replace('\]\]\>', ']]>', $text); | |
$text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text); | |
$text = strip_tags($text, '<a>'); | |
} |
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 | |
$categories = get_the_category(); | |
$x = $categories[0]->cat_ID; | |
print_r($x); | |
?> |
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 remove_comment_fields($fields) { | |
unset($fields['email']); | |
unset($fields['url']); | |
return $fields; | |
} | |
add_filter('comment_form_default_fields', 'remove_comment_fields'); | |
?> |
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 | |
/** | |
* Change the excerpt more string. | |
* @param string $more | |
* @return string | |
*/ | |
function custom_excerpt_more( $more ) { | |
return '…'; | |
} | |
add_filter( 'excerpt_more', 'custom_excerpt_more' ); |
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 | |
/** | |
* Control excerpt length. | |
*/ | |
function custom_excerpt_length( $length ) { | |
return 15; | |
} | |
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 ); | |
?> |