,,,,
,';
$text = strip_tags($text, $allowed_tags);
$words = preg_split("/[\n\r\t ]+/", $text, $mantra_excerptwords + 1, PREG_SPLIT_NO_EMPTY);
if ( count($words) > $mantra_excerptwords ) {
array_pop($words);
$text = implode(' ', $words);
$text = $text .' '.$mantra_excerptdots. ' ' .$mantra_excerptcont.' ' . '';
} else {
$text = implode(' ', $words);
}
}
return apply_filters('wp_trim_excerpt', $text, $raw_excerpt);
}
if ($mantra_excerpttags=='Enable') {
remove_filter('get_the_excerpt', 'wp_trim_excerpt');
add_filter('get_the_excerpt', 'mantra_trim_excerpt');
}
/**
* Remove inline styles printed when the gallery shortcode is used.
*
* Galleries are styled by the theme in Mantra's style.css.
*
* @since mantra 0.5
* @return string The gallery style filter, with the styles themselves removed.
*/
function mantra_remove_gallery_css( $css ) {
return preg_replace( "##s", '', $css );
}
add_filter( 'gallery_style', 'mantra_remove_gallery_css' );
if ( ! function_exists( 'mantra_posted_on' ) ) :
/**
* Prints HTML with meta information for the current post—date/time and author.
*
* @since mantra 0.5
*/
function mantra_posted_on() {
global $mantra_options;
foreach ($mantra_options as $key => $value) {
${"$key"} = $value ;
}
// If date is hidden don't give it a value
$date_string=' %3$s | ';
if ($mantra_postdate == "Hide") $date_string='';
// If author is hidden don't give it a value
$author_string = sprintf( '',
get_author_posts_url( get_the_author_meta( 'ID' ) ),
sprintf( esc_attr__( 'View all posts by %s', 'mantra' ), get_the_author() ),
get_the_author()
) ;
if ($mantra_postauthor == "Hide") $author_string='';
// Print the meta data
printf( ' %4$s '.$date_string.' %2$s ',
'meta-prep meta-prep-author',
get_the_category_list( ', ' ),
sprintf( '%3$s - %2$s',
get_permalink(),
esc_attr( get_the_time() ),
get_the_date()
), $author_string
);
}
endif;
// Remove category from rel in categry tags.
add_filter( 'the_category', 'mantra_remove_category_tag' );
add_filter( 'get_the_category_list', 'mantra_remove_category_tag' );
function mantra_remove_category_tag( $text ) {
$text = str_replace('rel="category tag"', 'rel="tag"', $text); return $text;
}
if ( ! function_exists( 'mantra_posted_in' ) ) :
/**
* Prints HTML with meta information for the current post (category, tags and permalink).
*
* @since mantra 0.5
*/
function mantra_posted_in() {
// Retrieves tag list of current post, separated by commas.
$tag_list = get_the_tag_list( '', ', ' );
if ( $tag_list ) {
$posted_in = ''.__( 'Tagged','mantra').' %2$s.'.__(' Bookmark the ','mantra').' '.__('permalink','mantra').'.';
} elseif ( is_object_in_taxonomy( get_post_type(), 'category' ) ) {
$posted_in = ''.__( 'Bookmark the ','mantra'). ' '.__('permalink','mantra').'. ';
} else {
$posted_in = ''.__( 'Bookmark the ','mantra'). ' '.__('permalink','mantra').'. ';
}
// Prints the string, replacing the placeholders.
printf(
$posted_in,
get_the_category_list( ', ' ),
$tag_list,
get_permalink(),
the_title_attribute( 'echo=0' )
);
}
endif;
if ( ! function_exists( 'mantra_content_nav' ) ) :
/**
* Display navigation to next/previous pages when applicable
*/
function mantra_content_nav( $nav_id ) {
global $wp_query;
if ( $wp_query->max_num_pages > 1 ) : ?>
1,
'order'=> 'ASC',
'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, 'custom' );
return $image_attributes[0];
}
}
}
if ( ! function_exists( 'mantra_set_featured_thumb' ) ) :
/**
* Adds a post thumbnail and if one doesn't exist the first image from the post is used.
*/
function mantra_set_featured_thumb() {
global $mantra_options;
foreach ($mantra_options as $key => $value) {
${"$key"} = $value ;
}
global $post;
$image_src = cryout_echo_first_image($post->ID);
if ( function_exists("has_post_thumbnail") && has_post_thumbnail() && $mantra_fpost=='Enable')
the_post_thumbnail( 'custom', array("class" => "align".strtolower($mantra_falign)." post_thumbnail" ) );
else if ($mantra_fpost=='Enable' && $mantra_fauto=="Enable" && $image_src && ($mantra_excerptarchive != "Full Post" || $mantra_excerpthome != "Full Post"))
echo '
' ;
}
endif; // mantra_set_featured_thumb
if ($mantra_fpost=='Enable' && $mantra_fpostlink) add_filter( 'post_thumbnail_html', 'mantra_thumbnail_link', 10, 3 );
/**
* The thumbnail gets a link to the post's page
*/
function mantra_thumbnail_link( $html, $post_id, $post_image_id ) {
$html = '' . $html . '';
return $html;
}
?>