0)&&(strlen($title)>0))?$title.' - '.$site_name:$title.$site_name);
// Get the Site Description
$site_description = get_bloginfo( 'description' );
// If site front page, append description
if ( (is_home() || is_front_page()) && $site_description ) {
// Append Site Description to title
$filtered_title = ((strlen($site_name)>0)&&(strlen($site_description)>0))?$site_name. " | ".$site_description:$site_name.$site_description;
}
// Add pagination if that's the case
global $page, $paged;
if ( $paged >= 2 || $page >= 2 )
$filtered_title .= ' | ' . sprintf( __( 'Page %s', 'mantra' ), max( $paged, $page ) );
// Return the modified title
return $filtered_title;
}
function mantra_filter_wp_title_rss($title) {
return ' ';
}
add_filter( 'wp_title', 'mantra_filter_wp_title' );
add_filter('wp_title_rss','mantra_filter_wp_title_rss');
/**
* Meta description
*/
function mantra_seo_description() {
global $mantra_options;
foreach ($mantra_options as $key => $value) {
${"$key"} = $value ;}
if ( (is_home() && $mantra_seo_home_desc) || (is_page_template('template-blog.php') && $mantra_seo_home_desc) ) {
echo PHP_EOL.''; }
else if ((is_single() || is_page()) && !is_404()) {
if ($mantra_seo_gen_desc =="Auto") {
global $post;
$content_post = get_post($post->ID);
$content = strip_shortcodes($content_post->post_content);
$content = preg_replace(array('/\s{2,}/', '/[\t\n]/'), ' ', $content);
$content = strip_tags($content);
$content = str_replace('"','',$content);
$content = preg_replace('/((\w+\W+\'*){'.(33).'}(\w+))(.*)/', '${1}', $content);
}
else if ($mantra_seo_gen_desc=="Manual") {
global $post,$mantra_meta_box_description;
$content = get_post_meta($post->ID,'SEOdescription_value',true);
}
echo PHP_EOL.''; }
else if (is_category() && category_description() != "") {
echo PHP_EOL.''; }
}
/**
* Meta author
*/
function mantra_seo_name() {
global $mantra_options;
foreach ($mantra_options as $key => $value) {
${"$key"} = $value ;}
echo '';
}
/**
* Meta Title
*/
function mantra_seo_title() {
echo '';
}
// Mantra main seo function
function mantra_seo_generator() {
global $mantra_options;
foreach ($mantra_options as $key => $value) {
${"$key"} = $value ;}
add_action ('cryout_seo_hook','mantra_seo_title');
add_action ('cryout_seo_hook','mantra_seo_description');
if($mantra_seo_author && $mantra_seo_author!="Do not use")
add_action ('cryout_seo_hook','mantra_seo_name');
}
if($mantra_seo=="Enable") mantra_seo_generator() ;
else add_action ('cryout_seo_hook','mantra_seo_title',0);
// Mantra favicon
function mantra_fav_icon() {
global $mantra_options;
foreach ($mantra_options as $key => $value) {
${"$key"} = $value ;}
echo '';
echo '';
}
if ($mantra_options['mantra_favicon']) add_action ('cryout_header_hook','mantra_fav_icon');
/*
Plugin Name: Custom Write Panel
Plugin URI: http://wefunction.com/2008/10/tutorial-create-custom-write-panels-in-wordpress
Description: Allows custom fields to be added to the WordPress Post Page
Version: 1.0
Author: Spencer
Author URI: http://wefunction.com
/* ----------------------------------------------*/
$mantra_meta_box_description =
array(
"image" => array(
"name" => "SEOdescription",
"std" => "",
"title" => "Input the SEO description for this post/page here (about 160 characters): ",
"description" => "This description is for SEO purposes only. It will be used as a meta in your HTML header. It won't be vislbe anywhere else.
More SEO options in the Mantra Settings Page >> Misc Options >> SEO.")
);
function mantra_meta_box_description() {
global $post, $mantra_meta_box_description;
foreach($mantra_meta_box_description as $meta_box) {
$meta_box_value = get_post_meta($post->ID, $meta_box['name'].'_value', true);
if($meta_box_value == "")
$meta_box_value = $meta_box['std'];
echo '';
echo '
'.$meta_box['title'].'
'; echo '