ThemeShaper Forums » Thematic

[closed]

Change doctitle

(4 posts)
  • Started 7 years ago by astima
  • Latest reply from drewdavid
  • This topic is not resolved
  1. astima
    Member

    I want my doctitle on every page to be the same, so I wrote in a function but I think it's wrong because it's not working. Any suggestions?

    function childtheme_doctitle() { 
    
    <title>Christensen Tamburri Communications Advertising and PR</title>
    
    } 
    
    // Add the filter to the original function
    add_filter('thematic_doctitle', 'childtheme_doctitle');
    Posted 7 years ago #
  2. astima
    Member

    Here is my revised function. It's still not working but I realized my other one was too simple.

    function childtheme_doctitle() { 
    
    // You don't want to change this one.
    $site_name = get_bloginfo('name');    
    
    // But you like to have a different separator
    $separator = '&raquo;';    
    
    // We will keep the original code  
    
    $content = get_bloginfo('description');  
    
    // until we reach this point. You want to have the site_name everywhere?  // Ok .. here it is.
    $my_elements = array(
    'site_name' => $site_name,
    'separator' => $separator,
    'content' => $content );    
    
    // And don't forget to return your new creation
    $my_elements = array_reverse($my_elements);  
    
    return $my_elements;   } 
    
    // Add the filter to the original function
    add_filter('thematic_doctitle', 'childtheme_doctitle');
    Posted 7 years ago #
  3. AnotherAndrew
    Member

    Here you go:

    // Change document titles
    function mgd_doctitle() {
    	$site_name = get_bloginfo('name');
        $separator = ' | ';
    
    if ( is_single() ) {
    	global $post;
    	$post_categories = get_the_category($post->ID);
    	$category_name = $post_categories[0]->cat_name;
    
    	$title = single_post_title('', FALSE) . ' | ' . $category_name . ' | ' . $site_name ;
     }
    	elseif ( is_home() || is_front_page() ) {
    		$title = $site_name . get_bloginfo('description');
        }
        elseif ( is_page() ) {
    		$title = single_post_title('', FALSE) . ' | ' . $site_name ;
        }
        elseif ( is_search() ) {
    		$search_results = __('Search results for:', 'thematic');
    		$search_results .= ' ' . wp_specialchars(stripslashes(get_search_query()), true);
    		$title = $search_results . ' | ' . $site_name ;
        }
        elseif ( is_category() ) {
    		$category = __('', 'thematic');
    		$category .= ' ' . single_cat_title("", false); ;
    		$title = $category . ' | ' . $site_name ;
        }
        elseif ( is_tag() ) {
    		$tag = __('Tag Archives:', 'thematic');
    		$tag .= ' ' . thematic_tag_query();
    		$title = $site_name . ' | ' . $tag;
        }
        elseif ( is_404() ) {
    		$error = __('Not Found', 'thematic');
    		$title = $site_name . ' | ' . $error;
        }
        else {
    		$title = $site_name . ' | ' . get_bloginfo('description');
        }
    
    	$title = "\t" . "<title>" . $title . "</title>" . "\n\n";
    
        echo apply_filters( 'mgd_doctitle', $title );
    }
    add_filter('thematic_doctitle','mgd_doctitle');
    Posted 7 years ago #
  4. Hi Andrew,

    This is working for me (thanks!), except that on the home page there is no separation. The title and the description run right together. Any idea what's the matter?

    Thanks. :)

    Posted 7 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.