• When I create a new page like a home page, about page, contact page, etc., the page titles and the auto generated navigation text links say “Home”, “About Us”, “Contact Us”, etc. But rather than displaying “Home” or “About Us” again at the top of the main content of each of these pages, I’d like to have custom headlines instead. Something like “Let’s get together!” on the home page, “About the ABC Company” on the about page, “We’d love to hear from you!” on the contact page, etc. Is it possible to have short navigation menu text based upon the page title, but customized headline text at the top of the body of each page?

Viewing 2 replies - 1 through 2 (of 2 total)
  • One possibility would be to have a Custom Field (e.g. ‘headline’) that contains the desired headline text. Then have the page template check for the custom field and display it instead of the page title.

    glowingpurplebunny

    (@glowingpurplebunny)

    Based on vtxyzzy’s suggestion, I wrote some code that does just that.

    In your WordPress page, make a custom field Named newtitle and set the Value to be the new title you want for the page.

    Then in your page template (usually page.php) replace ‘<h1><?php the_title();?></h1>’

    with

    ‘<?php
    global $post;
    $newtitle = get_post_meta($post->ID,”newtitle”,true);
    if ($newtitle): echo “<h1>$newtitle</h1>”;
    else: ?>
    <h1><?php the_title();?></h1>
    <?php endif; ?>’

    It basically checks to see if there’s a custom field called “newtitle” and if there is, echo that as the title of the page. If there’s not, it does the default and displays the normal title of the page.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom page headlines without affecting page title or menu’ is closed to new replies.