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 | |
// Remove the admin bar from the front end | |
add_filter( 'show_admin_bar', '__return_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 | |
// Put post thumbnails into rss feed | |
function wpfme_feed_post_thumbnail($content) { | |
global $post; | |
if(has_post_thumbnail($post->ID)) { | |
$content = '' . $content; | |
} | |
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 | |
// Add this in your functions file | |
function count_post_visits() { | |
if( is_single() ) { | |
global $post; | |
$views = get_post_meta( $post->ID, 'my_post_viewed', true ); | |
if( $views == '' ) { | |
update_post_meta( $post->ID, 'my_post_viewed', '1' ); | |
} else { | |
$views_no = intval( $views ); |
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 lightbox to all images embedded in a post | |
add_filter('the_content', 'my_addlightboxrel'); | |
function my_addlightboxrel($content) { | |
global $post; | |
$pattern ="/<a(.*?)href=('|\")(.*?).(bmp|gif|jpeg|jpg|png)('|\")(.*?)>/i"; | |
$replacement = '<a$1href=$2$3.$4$5 rel="lightbox" title="'.$post->post_title.'"$6>'; | |
$content = preg_replace($pattern, $replacement, $content); | |
return $content; |