public function toHtml() { gs_remove_entry_title(); $class = 'entry-title'; if ($this->css_class) { $class .= ' ' . $this->css_class; } $title = ''; if ($this->type == 'image') { $class .= ' entry-title-image'; $title = "<img class='entry-title-image' src='" . $this->image . "' />"; } else { if ($this->type == 'text') { // This is the header if ($this->header !== null) { $title = "<h1>" . $this->header . "</h1>"; } if ($this->subheader) { $title .= "<h2>" . $this->subheader . "</h2>"; } } else { $title = '<h1>' . get_the_title() . '</h1>'; } } $html = sprintf("<header class='%s'>\n", $class); $html .= $title . "\n"; $html .= "</header>"; return $html; }
function gs_create_entry_title() { /* * If this is a single post or a page we want to take the * title of the post / page for our banner. * * If we are viewing a category or archive of some type, we * want to take the title from that archive. * * I really need to create a unique 404 page. */ $class = 'entry-title'; if (is_single() || is_page()) { gs_remove_entry_title(); $title = get_the_title(); $class .= ' single'; } else { if (is_author()) { $title = get_the_author(); $class .= ' author'; } else { if (is_category() || is_archive()) { $class .= ' archive'; $cats = get_the_category(); $cat = $cats[0]; $title = $cat->name; } else { if (is_404()) { $title = "Ooops! I don't know what your looking for..."; $class .= ' c404'; } } } } $html = sprintf("<header class='%s'>\n", $class); $html .= "<h1>{$title}</h1>\n"; $html .= "</header>"; return $html; }