,,,,
,';
$text = strip_tags($text, $allowed_tags);
$words = preg_split("/[\n\r\t ]+/", $text, $nirvana_excerptlength + 1, PREG_SPLIT_NO_EMPTY);
if ( count($words) > $nirvana_excerptlength ) {
array_pop($words);
$text = implode(' ', $words);
} else {
$text = implode(' ', $words);
}
return $text;
}
if ($nirvana_excerpttags == 'Enable') {
remove_filter( 'get_the_excerpt', 'nirvana_custom_excerpt_more',10 );
remove_filter( 'get_the_excerpt', 'nirvana_excerpt_length_chars' );
add_filter('get_the_excerpt', 'nirvana_trim_excerpt');
add_filter('get_the_excerpt', 'do_shortcode');
}
/**
* Remove inline styles printed when the gallery shortcode is used.
*
* Galleries are styled by the theme in Nirvana's style.css.
*
* @since nirvana 0.5
* @return string The gallery style filter, with the styles themselves removed.
*/
function nirvana_remove_gallery_css( $css ) {
return preg_replace( "##s", '', $css );
}
add_filter( 'gallery_style', 'nirvana_remove_gallery_css' );
function nirvana_author_on() {
global $post;
if (is_single() && get_the_author_meta('user_url',$post->post_author)) {
echo '';
}
}
add_action ('wp_head','nirvana_author_on');
if ( ! function_exists( 'nirvana_posted_on' ) ) :
/**
* Prints HTML with meta information for the current post—date/time and author.
*
* @since nirvana 0.5
*/
function nirvana_posted_on() {
global $nirvanas;
foreach ($nirvanas as $key => $value) {
${"$key"} = $value;
}
// If single page take appropiate settings
if (is_single()) {
$nirvana_blog_show = $nirvana_single_show;
}
// Post Author
$output="";
if ($nirvana_blog_show['author']) {
$output .= sprintf( '
'.
'';
}
// Post categories
if ($nirvana_blog_show['category'] && get_the_category_list()) {
$output .= ''
. get_the_category_list( ', ' ) . ' ' ;
}
echo $output;
}; // nirvana_posted_on()
endif;
if ( ! function_exists( 'nirvana_posted_after' ) ) :
/**
* Prints HTML with tags information for the current post. ALso adds the edit button.
* @since nirvana 0.9
*/
function nirvana_posted_after() {
global $nirvanas;
foreach ($nirvanas as $key => $value) {
${"$key"} = $value;
}
$tag_list = get_the_tag_list( '', ', ' );
if ( $tag_list && ($nirvana_blog_show['tag']) ) : ?>
', '' );
cryout_post_footer_hook();
}; // nirvana_posted_after()
endif;
function nirvana_meta_infos() {
global $nirvanas;
foreach ($nirvanas as $key => $value) {
${"$key"} = $value;
}
switch($nirvana_metapos):
case "Bottom":
add_action('cryout_post_after_content_hook','nirvana_posted_on',10);
add_action('cryout_post_after_content_hook','nirvana_posted_after',11);
add_action('cryout_post_after_content_hook','nirvana_comments_on',12);
break;
case "Top":
if( !is_single()) {
add_action('cryout_post_meta_hook','nirvana_posted_on',10);
add_action('cryout_post_meta_hook','nirvana_posted_after',11);
add_action('cryout_post_meta_hook','nirvana_comments_on',12);
}
break;
default:
break;
endswitch;
}
add_action('wp_head','nirvana_meta_infos');
// Remove category from rel in categry tags.
add_filter( 'the_category', 'nirvana_remove_category_tag' );
add_filter( 'get_the_category_list', 'nirvana_remove_category_tag' );
function nirvana_remove_category_tag( $text ) {
$text = str_replace('rel="category tag"', 'rel="tag"', $text);
return $text;
}
if ( ! function_exists( 'nirvana_posted_in' ) ) :
/**
* Prints HTML with meta information for the current post (category, tags and permalink).
* @since nirvana 0.5
*/
function nirvana_posted_in() {
global $nirvanas;
foreach ($nirvanas as $key => $value) {
${"$key"} = $value;
}
if ($nirvana_single_show['tag'] || $nirvana_single_show['bookmark']) {
// Retrieves tag list of current post, separated by commas.
$posted_in="";
$tag_list = get_the_tag_list( '', ', ' );
if ( $tag_list && $nirvana_single_show['tag'] ) {
$posted_in .= ' ';
}
if ($nirvana_single_show['bookmark'] ) {
$posted_in .= ' '.__('Bookmark','nirvana').'.';
}
// Prints the string, replacing the placeholders.
printf(
$posted_in,
get_the_category_list( ', ' ),
$tag_list,
esc_url( get_permalink() ),
the_title_attribute( 'echo=0' )
);
}
}; // nirvana_posted_in()
endif;
if ( ! function_exists( 'nirvana_content_nav' ) ) :
/**
* Display navigation to next/previous pages when applicable
*/
function nirvana_content_nav( $nav_id ) {
global $wp_query;
if ( $wp_query->max_num_pages > 1 ) : ?>
1,
'orderby' => 'none',
'post_mime_type'=> 'image',
'post_parent' => $postID,
'post_status' => 'any',
'post_type' => 'any'
);
$attachments = get_children( $args );
//print_r($attachments);
if ($attachments) {
foreach($attachments as $attachment) {
$image_attributes = wp_get_attachment_image_src( $attachment->ID, 'custom' ) ?
wp_get_attachment_image_src( $attachment->ID, 'custom' ) :
wp_get_attachment_image_src( $attachment->ID );
return esc_url( $image_attributes[0] );
}
}
}; // echo_first_image()
if ( ! function_exists( 'nirvana_set_featured_thumb' ) ) :
/**
* Adds a post thumbnail and if one doesn't exist the first image from the post is used.
*/
function nirvana_set_featured_thumb() {
global $nirvanas;
foreach ($nirvanas as $key => $value) {
${"$key"} = $value;
}
global $post;
$image_src = cryout_echo_first_image($post->ID);
if ( function_exists("has_post_thumbnail") && has_post_thumbnail() && $nirvana_fpost=='Enable') {
the_post_thumbnail( 'custom', array("class" => "align" . strtolower($nirvana_falign) . " post_thumbnail" ) );
} else if ($nirvana_fpost=='Enable' && $nirvana_fauto=="Enable" && $image_src ) {
echo '
' ;
}
};
endif; // nirvana_set_featured_thumb
if ($nirvana_fpost=='Enable' && $nirvana_fpostlink) {
add_filter( 'post_thumbnail_html', 'nirvana_thumbnail_link', 10, 2 );
}
/**
* The thumbnail gets a link to the post's page
*/
function nirvana_thumbnail_link( $html, $post_id ) {
$html = '' . $html . '';
return $html;
}; // nirvana_thumbnail_link()
?>
',
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
sprintf( esc_attr( __( 'View all posts by %s', 'nirvana' ) ), get_the_author() ),
get_the_author()
);
}
// Post date/time
if ($nirvana_blog_show['date'] || $nirvana_blog_show['time'] ) {
$separator="";$date="";$time ="";
if ( $nirvana_blog_show['date'] && $nirvana_blog_show['time'] ) {
$separator = " - ";
}
if ($nirvana_blog_show['date']) {
$date = get_the_date();
}
if ($nirvana_blog_show['time']) {
$time = esc_attr( get_the_time() );
}
$output .= '