publish; //publish, draft
$num_posts = sprintf( _n( '%s Beitrag', '%s Beiträge', $num_posts ), number_format_i18n( $num_posts ) );
$num_pages = wp_count_posts( 'page' );
$num_pages = $num_pages->publish; //publish
$num_pages = sprintf( _n( '%s Seite', '%s Seiten', $num_pages ), number_format_i18n( $num_pages ) );
$num_cats = wp_count_terms('category');
$num_tags = wp_count_terms('post_tag');
$num_comm = get_comment_count();
$num_comm = $num_comm['approved']; //approved, awaiting_moderation, spam, total_comments
$num_comm = sprintf( _n( '%s Kommentar', '%s Kommentare', $num_comm ), number_format_i18n( $num_comm ) );
$num_comm2 = wp_count_comments( );
$num_comm2 = $num_comm2->approved; //approved, moderated, spam, total_comments
}
// widget function
if ( function_exists('register_sidebars') )
register_sidebars(0);
function fb_widget_register() {
if ( function_exists('register_sidebar') ) {
register_sidebar(array(
'name' => 'Sidebar',
'before_widget' => "\n\t\t" . '
',
'after_widget' => '',
'before_title' => "\n\t" . '',
));
}
}
add_action('widgets_init', 'fb_widget_register', 1);
/**
* related post with wordpress-tags
* wordpress > 2.3
*/
if (!function_exists('fb_related_posts')) {
function fb_get_related_posts($limit) {
global $wpdb, $post;
$now = current_time('mysql', 1);
$tags = wp_get_post_tags($post->ID);
$taglist = "'" . str_replace( "'", '', str_replace( '"', '', urldecode( $tags[0]->term_id ) ) ). "'";
$tagcount = count($tags);
if ( $tagcount > 1 ) {
for ($i = 1; $i <= $tagcount; $i++) {
$taglist = $taglist . ", '" . str_replace( "'", '', str_replace( '"', '', urldecode( $tags[$i]->term_id ) ) ) . "'";
}
}
$q = "SELECT DISTINCT p.*, count(t_r.object_id) as cnt FROM $wpdb->term_taxonomy t_t, $wpdb->term_relationships t_r, $wpdb->posts p WHERE t_t.taxonomy ='post_tag' AND t_t.term_taxonomy_id = t_r.term_taxonomy_id AND t_r.object_id = p.ID AND (t_t.term_id IN ($taglist)) AND p.ID != $post->ID AND p.post_status = 'publish' AND p.post_date_gmt < '$now' GROUP BY t_r.object_id ORDER BY cnt DESC, p.post_date_gmt DESC LIMIT $limit;";
return $wpdb->get_results($q);
}
function fb_related_posts($limit = 5) {
if ( function_exists('get_the_tags') ) {
$related_posts = fb_get_related_posts($limit) ;
}
if ( $related_posts ) {
foreach ($related_posts as $related_post ) {
$post_date = preg_replace("/(\d+)\-(\d+)\-(\d+) (\d+)\:(\d+)\:(\d+)/is", "$3.$2.$1" , $related_post->post_date);
$related_post_output = '';
$related_post_output = $related_post_output . '' . wptexturize($related_post->post_title);
$related_post_output = $related_post_output . '';
echo $related_post_output;
}
} else {
echo '' . __('Keine ähnlichen Beiträge', FB_BASIS_TEXTDOMAIN) . '';
}
}
}
/**
* liefert TRUE, wenn Post in Unterkategorie ist, sonst FALSE
* Example: if (is_in_category(3, 5, 7))
*/
if ( !function_exists('fb_in_category') ) {
function fb_in_category() {
if ( func_num_args() > 0 ) {
foreach( func_get_args() as $category ) {
if ( in_category($category) ) {
return( true );
}
}
}
return false;
}
}
/**
* childrens for pages
* work: page active --> list the childrens of the page
*/
function get_children_pages() {
global $wp_query;
if ( empty($wp_query->post->post_parent) ) {
$parent = $wp_query->post->ID;
} else {
$parent = $wp_query->post->post_parent;
}
wp_list_pages('title_li=&child_of=$parent&depth=');
}
/**
* custom login for theme
* folder themes/theme_name/custom-login/
*/
if ( !function_exists('fb_custom_login') ) {
function fb_custom_login() {
echo '';
}
//add_action('login_head', 'fb_custom_login');
}
/**
* kill login-screen CSS
*/
//if ( basename($_SERVER['PHP_SELF']) == 'wp-login.php' )
// add_action( 'style_loader_tag', create_function( '$a', "return null;" ) );
/**
* breadcrump Navigation
*/
if ( !function_exists('fb_breadcrumb_nav') ) {
function fb_breadcrumb_nav() {
if ( !is_home() || !is_front_page() ) {
_e('» ') . bloginfo('name') . _e(' » ');
if ( is_category() ) {
single_cat_title();
//the_category(', ');
} elseif ( is_single() ) {
the_category(', ') . _e(' » ') . the_title();
} elseif ( is_page() ) {
_e( the_title() . '
');
} elseif (is_page() && $post->post_parent ) {
_e( get_the_title($post->post_parent) );
_e(' » ');
_e( the_title() );
} elseif ( is_search() ) {
_e('Suche nach: ') . the_search_query() . _e('');
}
}
}
}
/**
* add shortcode werbung with 3 custom fields
*
* so einbinden:
* if ( function_exists('add_shortcode') )
* add_shortcode('fb_werbung', 'fb_example_link');
*
* so nutzen, direkt im Content:
* [fb_werbung]
*/
if ( !function_exists('fb_example_link') ) {
function fb_example_link() {
global $wp_query;
$postID = $wp_query->post->ID;
$mylink = get_post_custom_values('link', $postID);
$mypic = get_post_custom_values('bild', $postID);
$mylinktext = get_post_custom_values('linktext', $postID);
return '
';
}
//if ( function_exists('add_shortcode') )
// add_shortcode('fb_werbung', 'fb_example_link');
}
/**
* add shortcode for inport rss-feed in content
*
* so einbinden:
* if ( function_exists('add_shortcode') )
* add_shortcode('fb_werbung', 'fb_example_link');
*
* so nutzen, direkt im content:
* [rss feed="http://bueltge.de/feed/" num="10"]
*/
if ( !function_exists('fb_importRSS') ) {
if (file_exists(ABSPATH . WPINC . '/rss.php') ) {
include_once(ABSPATH . WPINC . '/rss.php');
function fb_importRSS($atts) {
extract( shortcode_atts( array(
"feed" => 'http://bueltge.de/feed/',
"num" => '5',
), $atts) );
return wp_rss($feed, $num);
}
//if ( function_exists('add_shortcode') )
// add_shortcode('importrss', 'fb_importRSS');
}
}
/**
* add shortcode for import posts in content
*
* so einbinden:
* if ( function_exists('add_shortcode') )
* add_shortcode("posts", "fb_get_posts");
*
* so nutzen, direkt im content:
* [posts num="5" cat="1"]
*/
if ( !function_exists('fb_get_posts') ) {
function fb_get_posts($atts, $content = null) {
extract( shortcode_atts( array(
"num" => '5',
"cat" => '-1'
), $atts) );
global $post;
$myposts = get_posts('numberposts=' . $num . '&order=DESC&orderby=post_date&category=' . $cat);
$retour = ' ';
return $retour;
}
//if ( function_exists('add_shortcode') )
// add_shortcode("posts", "fb_get_posts");
}
/**
* add secure mail in content
*
* so einbinden:
* if ( function_exists('add_shortcode') )
* add_shortcode("posts", "fb_secure_mail");
*
* so nutzen, direkt im content:
* [sm mailto="foo@bar.com" txt="here is my mail"]
*/
if ( !function_exists('fb_secure_mail') ) {
function fb_secure_mail($atts) {
extract( shortcode_atts(array(
"mailto" => '',
"txt" => ''
), $atts) );
$mailto = antispambot($mailto);
$txt = antispambot($txt);
return '' . $txt . '';
}
if ( function_exists('add_shortcode') )
add_shortcode('sm', 'fb_secure_mail');
}
/**
* add shortcode to kill all shortcodes on the post or page
*
* so einbinden:
* [KSC][/KSC]
*/
if ( !function_exists('fb_kill_shortcodes') ) {
function fb_kill_shortcodes( $attributes, $content=NULL ) {
return $content;
}
add_shortcode('KSC', 'fb_kill_shortcodes');
}
/**
* Shortcodes in Widgets aktivieren
*/
// add_filter('widget_text', 'do_shortcode');
/**
* gibt dass Land zurück, wo die IP her ist
*/
if ( !function_exists('fb_getUserCountry') ) {
function fb_getUserCountry() {
$url = 'http://api.wipmania.com/' . $_SERVER ['REMOTE_ADDR'] . '?' . get_bloginfo('home');
if ( function_exists('file_get_contents') ) {
return file_get_contents($url);
} else {
$ch = curl_init();
$timeout = 5;
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$content = curl_exec($ch);
curl_close($ch);
return $content;
}
}
// Ausgabe und Nutzung z.B. wie folgt im Template
// echo "Herkunft: " . getUserCountry();
// --> Herkunft: DE
}
/**
* Smart cache-busting
* cacht css des Themes
*/
if ( !function_exists('fb_css_cache_buster') ) {
function fb_css_cache_buster($info, $show) {
if ($show == 'stylesheet_url') {
// Is there already a querystring? If so, add to the end of that.
if (strpos($pieces[1], '?') === false) {
return $info . "?" . filemtime(WP_CONTENT_DIR . $pieces[1]);
} else {
$morsels = explode("?", $pieces[1]);
return $info . "&" . filemtime(WP_CONTENT_DIR . $morsles[1]);
}
} else {
return $info;
}
}
add_filter('bloginfo_url', 'fb_css_cache_buster', 9999, 2);
}
/**
* Tags im Dropdown-menu
*
* so einbinden:
*
*/
if ( !function_exists('fb_dropdown_tag_cloud') ) {
function fb_dropdown_tag_cloud( $args = '' ) {
$defaults = array(
'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45,
'format' => 'flat', 'orderby' => 'name', 'order' => 'ASC',
'exclude' => '', 'include' => ''
);
$args = wp_parse_args( $args, $defaults );
$tags = get_tags( array_merge($args, array('orderby' => 'count', 'order' => 'DESC')) ); // Always query top tags
if ( empty($tags) )
return;
$return = fb_dropdown_generate_tag_cloud( $tags, $args ); // Here's where those top tags get sorted according to $args
if ( is_wp_error( $return ) )
return false;
else
echo apply_filters( 'dropdown_tag_cloud', $return, $args );
}
function fb_dropdown_generate_tag_cloud( $tags, $args = '' ) {
global $wp_rewrite;
$defaults = array(
'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45,
'format' => 'flat', 'orderby' => 'name', 'order' => 'ASC'
);
$args = wp_parse_args( $args, $defaults );
extract($args);
if ( !$tags )
return;
$counts = $tag_links = array();
foreach ( (array) $tags as $tag ) {
$counts[$tag->name] = $tag->count;
$tag_links[$tag->name] = get_tag_link( $tag->term_id );
if ( is_wp_error( $tag_links[$tag->name] ) )
return $tag_links[$tag->name];
$tag_ids[$tag->name] = $tag->term_id;
}
$min_count = min($counts);
$spread = max($counts) - $min_count;
if ( $spread <= 0 )
$spread = 1;
$font_spread = $largest - $smallest;
if ( $font_spread <= 0 )
$font_spread = 1;
$font_step = $font_spread / $spread;
// SQL cannot save you; this is a second (potentially different) sort on a subset of data.
if ( 'name' == $orderby )
uksort($counts, 'strnatcasecmp');
else
asort($counts);
if ( 'DESC' == $order )
$counts = array_reverse( $counts, true );
$a = array();
$rel = ( is_object($wp_rewrite) && $wp_rewrite->using_permalinks() ) ? ' rel="tag"' : '';
foreach ( $counts as $tag => $count ) {
$tag_id = $tag_ids[$tag];
$tag_link = clean_url($tag_links[$tag]);
$tag = str_replace(' ', ' ', wp_specialchars( $tag ));
$a[] = "\t";
}
switch ( $format ) :
case 'array' :
$return =& $a;
break;
case 'list' :
$return = "\n\t- ";
$return .= join("
\n\t- ", $a);
$return .= "
\n
\n";
break;
default :
$return = join("\n", $a);
break;
endswitch;
return apply_filters( 'dropdown_generate_tag_cloud', $return, $tags, $args );
}
}
/**
* Kategorien im Loop ausnehmen
*
* so einbinden:
* add_action('pre_get_posts', 'fb_exclude_category');
*/
if ( !function_exists('fb_exclude_category') ) {
function fb_exclude_category() {
global $wp_query;
if ( is_home() ) { // wahlweise andere Conditional Tags
$wp_query->set( 'category__not_in', array(3, 5) );
}
}
}
//if (!is_admin))
// add_action('pre_get_posts', 'exclude_category');
/**
* Removing /category/ Automatically
*
* so einbinden:
* add_filter( 'user_trailingslashit', 'fb_fix_slash', 55, 2 );
*/
if ( !function_exists('fb_fix_slash') ) {
function fb_fix_slash( $string, $type ) {
global $wp_rewrite;
if ( $wp_rewrite->use_trailing_slashes == false ) {
if ( $type != 'single' && $type != 'category' )
return trailingslashit( $string );
if ( $type == 'single' && ( strpos( $string, '.html/' ) !== false ) )
return trailingslashit( $string );
if ( $type == 'category' && ( strpos( $string, 'category' ) !== false ) ) {
$aa_g = str_replace( "/category/", "/", $string );
return trailingslashit( $aa_g );
}
if ( $type == 'category' )
return trailingslashit( $string );
}
return $string;
}
//add_filter( 'user_trailingslashit', 'fb_fix_slash', 55, 2 );
}
/**
* Add Link Attribute
*
* so einbinden:
*
*
* so einbinden:
*
*
* , ,
, FALSE, name, TRUE', 'onclick="window.open(this.href,\'_blank\');return false;"'); ?>
*
*
*/
if ( !function_exists('fb_add_link_attr') ) {
function fb_add_link_attr($func='', $args='', $attr='', $imgtag=false) {
$tag = ($imgtag) ? "![]()
![]()
$link)
if ( 0 === strpos($link, $home) )
unset($links[$l]);
}
add_action( 'pre_ping', 'fb_noself_ping' );
}
/**
* Comments for > WP 2.7
*/
if ( !function_exists('fb_theme_comment') ) {
function fb_theme_comment($comment, $args, $depth) {
$GLOBALS['comment'] = $comment; ?>
id="comment-">
ID;
if ( !$post_id )
return;
if ( !isset($cjd_comment_count_cache[$post_id]) ) {
$p = get_post($post_id);
$p = array($p);
fb_update_comment_type_cache($p);
}
;
if ( $type == 'pingback' || $type == 'trackback' || $type == 'comment' )
$count = $cjd_comment_count_cache[$post_id][$type];
elseif ( $type == 'pings' )
$count = $cjd_comment_count_cache[$post_id]['pingback'] + $cjd_comment_count_cache[$post_id]['trackback'];
else
$count = array_sum((array) $cjd_comment_count_cache[$post_id]);
return apply_filters('fb_get_comment_type_count', $count);
}
// comment, trackback, pingback, pings, all
function fb_comment_type_count( $type='all', $zero = false, $one = false, $more = false, $post_id = 0 ) {
$number = fb_get_comment_type_count( $type, $zero, $one, $more, $post_id );
if ($type == 'all') {
$type_string_single = __('Comment', FB_BASIS_TEXTDOMAIN);
$type_string_plural = __('Comments', FB_BASIS_TEXTDOMAIN);
} elseif ($type == 'pings') {
$type_string_single = __('Ping and Trackback', FB_BASIS_TEXTDOMAIN);
$type_string_plural = __('Pings and Trackbacks', FB_BASIS_TEXTDOMAIN);
} elseif ($type == 'pingback') {
$type_string_single = __('Pingback', FB_BASIS_TEXTDOMAIN);
$type_string_plural = __('Pingbacks', FB_BASIS_TEXTDOMAIN);
} elseif ($type == 'trackback') {
$type_string_single = __('Trackback', FB_BASIS_TEXTDOMAIN);
$type_string_plural = __('Trackbacks', FB_BASIS_TEXTDOMAIN);
} elseif ($type == 'comment') {
$type_string_single = __('Comment', FB_BASIS_TEXTDOMAIN);
$type_string_plural = __('Comments', FB_BASIS_TEXTDOMAIN);
}
if ( $number > 1 )
$output = str_replace('%', number_format_i18n($number), ( false === $more ) ? __('%', FB_BASIS_TEXTDOMAIN) . ' ' . $type_string_plural : $more);
elseif ( $number == 0 )
$output = ( false === $zero ) ? __('No', FB_BASIS_TEXTDOMAIN) . ' ' . $type_string_plural : $zero;
else // must be one
$output = ( false === $one ) ? __('1', FB_BASIS_TEXTDOMAIN) . ' ' . $type_string_single : $one;
echo apply_filters('fb_comment_type_count', $output, $number);
}
}
if ( !function_exists('fb_update_comment_type_cache') ) {
function fb_update_comment_type_cache(&$queried_posts) {
global $cjd_comment_count_cache, $wpdb;
if ( !$queried_posts )
return $queried_posts;
foreach ( (array) $queried_posts as $post )
if ( !isset($cjd_comment_count_cache[$post->ID]) )
$post_id_list[] = $post->ID;
if ( $post_id_list ) {
$post_id_list = implode(',', $post_id_list);
foreach ( array('', 'pingback', 'trackback') as $type ) {
$counts = $wpdb->get_results("SELECT ID, COUNT( comment_ID ) AS ccount
FROM $wpdb->posts
LEFT JOIN $wpdb->comments ON ( comment_post_ID = ID AND comment_approved = '1' AND comment_type='$type' )
WHERE post_status = 'publish' AND ID IN ($post_id_list)
GROUP BY ID");
if ( $counts ) {
if ( '' == $type )
$type = 'comment';
foreach ( $counts as $count )
$cjd_comment_count_cache[$count->ID][$type] = $count->ccount;
}
}
}
return $queried_posts;
}
add_filter('the_posts', 'fb_update_comment_type_cache');
}
/**
* void fb_comment_paging_noindex_meta()
* Add meta noindex rules on Singular comment page section
*
* @author Avice D
* @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License
* @link http://blog.kaizeku.com/wordpress/prevent-wordpress-27-duplicate-content/
*
* @todo Check for duplicate meta-robots tag generated by
* meta-tag type plugins (SEO plugins)
*
* @uses $wp_query Wp_query object
* @return string Output HTML meta noindex
*/
function fb_comment_paging_noindex_meta()
{ global $wp_query;
if ( version_compare( (float) get_bloginfo('version'), 2.7, '>=') ) {
if ( $wp_query->is_singular && get_option('page_comments') ) { // comments paging enabled
if ( isset($wp_query->query['cpage'] ) && absint( $wp_query->query['cpage']) >= 1 ) {
echo '' . PHP_EOL;
}
}
}
}
add_action('wp_head','fb_comment_paging_noindex_meta');
/**
* check for searchengine-vistors
*
* Einbau im Theme:
* if ( fb_fromasearchengine() ) {
* PLATZHALTER FÜR HTML-/BANNER-CODE etc.
* }
*/
function fb_fromasearchengine(){
$ref = $_SERVER['HTTP_REFERER'];
$se = array('/search?', 'images.google.', 'search.', 'del.icio.us/search', '/search/', '.yahoo.');
foreach ($se as $source) {
if ( strpos($ref, $source) !== false ) {
setcookie( 'sevisitor', 1, time()+3600, '/', str_replace( 'http://', '', get_bloginfo('url') ) );
$sevisitor = true;
}
}
if ( $sevisitor == true || $_COOKIE["sevisitor"] == 1 ) {
return true;
}
return false;
}
/**
* Remove the more-ancher
*/
if ( !function_exists('fb_remove_more_anchor') ) {
function fb_remove_more_anchor($content) {
global $id;
return str_replace('#more-' . $id . '"', '"', $content);
}
//add_filter('the_content', 'fb_remove_more_anchor');
}
/**
* deletes IP and user-agent identification of all no-spam comments older than 15 days
*/
if ( !function_exists('fb_delete_comments_data') ) {
function fb_delete_comments_data() {
global $wpdb;
$r = $wpdb->query ("
UPDATE $wpdb->comments
SET comment_author_IP = '',
comment_agent = ''
WHERE comment_approved = '1'
AND comment_date < date_sub(now(), interval 15 day)
");
}
add_action('comment_post', 'fb_delete_comments_data');
}
/**
* make a excerpt automaticly
*/
function fb_excerpt($text) {
if ( '' == $text ) {
$text = get_the_content('');
$text = strip_shortcodes( $text );
$text = apply_filters('the_content', $text);
$text = str_replace(']]>', ']]>', $text);
$text = strip_tags($text);
$excerpt_length = 55;
$words = explode(' ', $text, $excerpt_length + 1);
if (count($words) > $excerpt_length) {
array_pop($words);
array_push($words, __('Read More') );
$text = implode(' ', $words);
}
}
return $text;
}
add_filter('get_the_excerpt', 'fb_excerpt', 1, 2);
/**
* alternate doctype
*
* so einbauen:
* bspw. in einem Template oder mit conditional tags abfragen
* fb_alternate_doctype();
*/
if ( !function_exists('fb_alternate_doctype') ) {
function fb_alternate_doctype() {
function start_output_collection() {
global $my_header_output_buffer;
$my_header_output_buffer = ob_start('plugin_callback');
}
function send_output() {
global $my_header_output_buffer;
if ( false !== $my_header_output_buffer )
$header = ob_get_contents( $my_header_output_buffer );
if ( false === $header )
die( 'send_output() failed to retrieve header output buffer. File: ' . __FILE__ . ' on line: ' . __LINE__ );
if ( false === ob_end_clean( $my_header_output_buffer ) )
error_log( 'send_output() received a failure when trying to remove an output buffer. File: ' . __FILE__ . ' on line: ' . __LINE__ );
$newdoctype = '';
// $newdoctype = '';
// $newdoctype = '';
$header = preg_replace( '|]*>|i', $newdoctype, $header );
echo $header;
}
add_action( 'get_header', 'start_output_collection', 1000 );
add_action( 'wp_head', 'send_output', 1000 );
}
}
/**
* get a short/tiny url
* @author: René Ade
* @link: http://www.rene-ade.de/inhalte/php-code-zum-erstellen-einer-tinyurl-ueber-tinyurl-com-api.html
*/
if ( !function_exists('fb_gettinyurl') ) {
function fb_gettinyurl( $url ) {
$fp = fopen( 'http://tinyurl.com/api-create.php?url=' . $url, 'r' );
if ( $fp ) {
$tinyurl = fgets( $fp );
if( $tinyurl && !empty($tinyurl) )
$url = $tinyurl;
fclose( $fp );
}
return $url;
}
}
/**
* filter rewrite rule for performance problems on post/pages with permalinks
*/
if ( !function_exists('fb_filter_rewrite_attachment') ) {
function fb_filter_rewrite_attachment($content) {
if ( !is_array($content) )
return $content;
foreach ($content as $key => $val) {
if (strpos($val, 'attachment') !== false)
unset($content[$key]);
}
return $content;
}
//add_filter('page_rewrite_rules', 'fb_filter_rewrite_attachment');
//add_filter('post_rewrite_rules', 'fb_filter_rewrite_attachment');
}
/**
* @return useragent
* Example: iPhone, iPod
* Code-Example: if ( (fb_agent("iPhone") != FALSE) || (fb_agent("iPod") != FALSE) ) { ... }
*/
if ( !function_exists('fb_agent') ) {
function fb_agent($browser) {
$useragent = $_SERVER['HTTP_USER_AGENT'];
return strstr($useragent, $browser);
}
}
/**
* @echo tags of post
* Code-Example:
*/
function fb_meta_tags() {
global $post;
$posttags = get_the_tags($post->ID);
if ( $posttags ) {
foreach( (array)$posttags as $tag ) {
$meta_tags .= $tag->name . ',';
}
echo '' . PHP_EOL;
}
}
/**
* clean excerpt from scripts and styles
*/
if ( !function_exists('fb_clean_excerpt') ) {
function fb_clean_excerpt($excerpt) {
$excerpt = preg_replace('#<(s(cript|tyle)).*?\1>#si', '', $excerpt);
return $excerpt;
}
add_filter('the_content', 'fb_clean_excerpt', 10, 1);
}
/**
* remove [...] from excerpt
*/
if ( !function_exists('fb_trim_excerpt') ) {
function fb_trim_excerpt($excerpt) {
$excerpt = rtrim($excerpt, '[...]');
return $excerpt;
}
//add_filter( 'get_the_excerpt', 'fb_trim_excerpt' );
}
/**
* remove nofollow from comment-author-link
*/
if ( !function_exists('fb_strip_nofollow') ) {
function fb_strip_nofollow($ret) {
$ret = str_replace( "rel='external nofollow'", "rel='external'", $ret );
return $ret;
}
add_filter( 'get_comment_author_link', 'fb_strip_nofollow' );
}
/**
* check ID post and child-post
* @link: http://bueltge.de/wordpress-seiten-unterseiten-abfragen/908/
*/
if ( !function_exists('fb_has_parent') ) {
function fb_has_parent( $post, $post_id ) {
if ($post->ID == $post_id)
return true;
elseif ($post->post_parent == 0)
return false;
else
return has_parent( get_post($post->post_parent), $post_id );
}
}
/**
* Disable Canonical URL Redirection
* feature of WP 2.3 and higher
*/
//remove_filter( 'template_redirect', 'redirect_canonical' );
?>