wordpress不同模板获取不同的meta信息

//META DESCRIPTION FUNCTION
function seometadescription(){
        global $post, $posts;
    if ( is_single() || is_page() ) : 
        $customDesc = 'meta_desc';
        if ( have_posts() ) : while ( have_posts() ) : the_post(); 
                $descriere = get_post_meta($post->ID, $customDesc, true);
            endwhile; 
        endif; 

    elseif( is_category() ):
        $descriere = category_description();
    elseif( is_front_page() ) : 
        $descriere = 'some words for front page description';
    endif; 
    $customMetaDesc = '<meta name="description" content="'.$descriere.'" />';
        echo $customMetaDesc;
}
// end meta desc function