ThemeShaper Forums » Thematic

[closed]

Tip: Modify Thematic Page-Title

(3 posts)
  • Started 3 years ago by ridgely
  • Latest reply from ridgely
  • This topic is not a support question
  1. Every two or three weeks, I'll see a question around here pertaining to thematic_page_title which you see at the top of thematic archive, category and tag pages. Usually the question is about removing the "Category/Tag/Search Archive:" text. But if you're like me, you have to make things even more complex. In my case, I wanted my page titles to not look quite so much like afterthoughts (apologies to our Noble Builder, Mr. Stewart). I also wanted the <div class="archive-meta"> on the same line with the page title. This caused a CSS problem with display, causing the actual posts to ride up next to the description. So I needed an additional div around h1 and <div class="archive-meta"> so I could keep the page title and description in line and keep the page content from crawling up next to them.

    In my functions.php file:

    function childtheme_page_title() {
    		if (is_category()) {
                                    $content .= '<div class="archive-head">'; /*Begin encompassing div*/
    				$content .= '<h1 class="page-title">';
    				$content .= __('', 'thematic'); /*This removes the "Category Archives:" text*/
    				$content .= ' <span>';
    				$content .= single_cat_title('', FALSE);
    				$content .= '</span></h1>';/*End Category Archive Title*/
    				$content .= '<div class="archive-meta">';/*Begin Category Description*/
    				if ( !(''== category_description()) ) : $content .= apply_filters('archive_meta', category_description()); endif;
    				$content .= '</div></div>' . "\n"; /*End description and close encompassing div*/
    			} elseif (is_tag()) {
    				$content .= '<div class="archive-head">';/*Same deal*/
    				$content .= '<h1 class="page-title">';
    				$content .= __('', 'thematic');
    				$content .= ' <span>';
    				$content .= single_tag_title('', FALSE);
    				$content .= '</span></h1>';
    				$content .= '<div class="archive-meta">';
    				if ( !(''== tag_description()) ) : $content .= apply_filters('archive_meta', tag_description()); endif;
    				$content .= '</div></div>' . "\n";
    			} elseif (is_tax())	{
    				global $taxonomy;
    				$content .= '<div class="archive-head">';
    				$content .= '<h1 class="page-title">';
    				$tax = get_taxonomy($taxonomy);
    				//$content .= $tax->labels->name . ' ';/*Hides the actual taxonomy name*/
    				$content .= __(' ', 'thematic');
    				$content .= '<span>';
    				$content .= thematic_get_term_name();/*Similar to single_cat_title*/
    				$content .= '</span></h1>';
    				$content .= '<div class="archive-meta">';
    				if ( !(''== term_description()) ) : $content .= apply_filters('archive_meta', term_description()); endif;
    				$content .= '</div></div>' . "\n";
    			}
    			return $content;
    		}
    add_filter('thematic_page_title', 'childtheme_page_title');

    Here's the CSS:

    /*=====CATEGORY ARCHIVE PAGE TITLES + DESCRIPTIONS====*/
    .archive-head {
    		margin: 0 auto;
    		width: 560px;
    		float: none;
    		clear: both;
    		overflow: hidden;
    		padding-bottom: 22px;
    }
    
    h1.page-title {
    		width: 200px;
    		float: left;
    		clear: none;
    		margin: 6px 10px 11px 0;
    		padding: 0 10px 0 0;
    		background: url('images/bracket.png') no-repeat scroll top right #fff;
    		height: 70px;
    }
    
    h1.page-title span {
    		font-family: Georgia, "Times New Roman", Times, serif;
    		font-size: 2.675em;
    		line-height: 1.125em;
    		font-weight: normal;
    		font-style: normal;
    }
    
    /* Styles Category Archive Descriptions */
    .archive-meta {
    		width: 330px;
    		float: left;
    		padding: 0;
    		margin: 0 0 11px 0;
    		font-style: italic;
    }
    
    .archive-meta p {
    		font-size: 1em/16px;
    		line-height: 1.375em/22px;
    		padding: 0 10px;
    }
    
    h1.page-title span,
    h1.page-title {
    		vertical-align: middle;
    }
    h1.page-title,
    .archive-meta {
    	vertical-align: middle;
    }
    /* END TAX/CAT ARCHIVE PAGE TITLES + DESCRIPTIONS====*/

    And you can see the result here (Contains no posts, but ready for when it does).

    Posted 3 years ago #
  2. your demo looks sweet. i will have to remember this post. i would agree that the page title looks like an afterthought... and when i am designing my themes, it is an afterthought for me too. this definitely steps up the page-title game. nice work.

    Posted 3 years ago #
  3. Thanks! I'm actually coming back to this page-title issue because I'm trying to figure out how to correctly write a function to spit out a similarly html'ed page title at the top of my custom post type page templates.

    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.