Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I use custom category templates for a few of my categories. Ex: cat-12.php and so on. I use the Fv Simpler Seo and presently it doesnt seem to support an option to edit category templates.

Considering that I use custom category templates, is there a function or a way I include custom meta description and custom title (over riding the default category name that is picked up as the title) without having to use a plugin?

share|improve this question
add comment

3 Answers

up vote 0 down vote accepted

for meta description of the category you can use followinf dunction

//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

$customDesc = is a custom field that I used for post and pages description If you have not ser a page as front page replace is_front_page() with is_home

For META keywords I found a function on this web site

share|improve this answer
add comment

agreed most category template files do start with get_header, then you can add between the ( content="") make sure you don't conflict with any php script.

share|improve this answer
add comment

Take a closer look at custom category templates. There must be an option to edit them. May be not through dashboard, may be right in theme or plugin folder. I think it's impossible that there is no option to edit templates.

share|improve this answer
    
Your answer is quite vague. The category template starts with the get header... –  Sledge81 Jul 29 '11 at 18:18
    
You have distinct file which respond for displaying content of this category. Right? In this case you can replace get_header() with content of header.php and edit title and description. –  Alexey Jul 29 '11 at 20:21
1  
I don't think that is a good practice to put the header contents directly into the category template files. –  Sledge81 Jul 30 '11 at 6:16
1  
agree, it's not a good practice, but it works :). Another solution - you may use conditional tag is_category() link –  Alexey Jul 30 '11 at 16:12
    
Probably.. will have to give that a try, if there is indeed no other method –  Sledge81 Jul 30 '11 at 18:52
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.