0

I have this command that I'm using. I want it to use the template formating for the title but I can't figure out how to add it. I found this code online to strip everything and I added <?php wp_title(); ?> which shows the title but in plain text. How can I add it to match the rest of the site? smdpphiladelphia.com

<?php
/**
 * Template Name: Clean Page
 * This template will only display the content you entered in the page editor
 */
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
    <meta charset="<?php bloginfo( 'charset' ); ?>">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <?php wp_head(); ?>

</head>
<body>
<?php wp_title(); ?>
<?php
    while ( have_posts() ) : the_post();  
        the_content();
    endwhile;
?>
<?php wp_footer(); ?>
</body>
</html>
0

Basically, if I understand your question properly, you will want to look for another file named "header.php" (or "page-{something}-header.php" for a special header that only applies to a specific page type), which represents what is output by wp-head() (shown in your code).

If you open header.php, you should find something like the following:

<head>
     <title> <?php wp_title(); ?></title>
...

Keep in mind, this can get really complex. There are many themes with several conditional statements to modify your page title for any of several different circumstances. See the following example of how complex a fairly simple theme can make it.

<?php
if (function_exists('is_tag') && is_tag()) {    
    echo 'Tag Archive for &quot;'.$tag.'&quot; - ';    
} elseif (is_archive()) {    
    wp_title(''); echo ' Archive - ';    
} elseif (is_search()) {    
    echo 'Search for &quot;'.wp_specialchars($s).'&quot; - ';    
} elseif ( (!(is_404()) && (is_single()) || (is_page()) ) && !(is_front_page()) ) {    
    wp_title(''); echo ' | ';    
} elseif (is_404()) {    
    echo 'Not Found - ';    
}
bloginfo('name');
?>
</title>

If you already like your theme, but just want to customize how the page titles are drawn, you may want to review this brief tutorial for a better way to update page titles throughout your site, using add_filter('document_title_parts','your_customizing_function') (documentation for document_title_parts).

| improve this answer | |
-1

I just figured out I could make it a lot easier by simpling adding teh custom attribute into the header code like so <h1 class="resurrect-entry-title resurrect-main-title">

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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