Support » Themes and Templates » Removing titles from a static page, but not all pages

  • Resolved ChicagoBarrister


    I am trying to keep my website layout as clean as possible, and to this end, I would like to remove the h2 titles from two pages on my site.

    Specifically, I want to remove:

    1)the block letter “My Loans” (and the grey underline) from the top of

    2)the block letter “Hire Me” (and the grey underline) from the top of

    I’ve searched the forums, and tried inserting “display: none;”, but that removed titles from all pages, including the titles of my posts on the homepage,

    Do I need to create a new page template for these two pages, or is there some way to remove titles based on the page id?

    Thanks in advance!

Viewing 7 replies - 1 through 7 (of 7 total)
  • If you intend to limit it’s use to just one or two pages, I believe you could quickly create (copy the default, alter as desired and rename) just one new template and apply it to any pages fitting that design. Otherwise, an introduction to Conditional Tags might be in order.


    So I looked at some other threads for conditional tags and templates, and creating a new template seems to be the better option since it will allow more flexibility going forward.

    So do I need to copy, modify and rename “page.php”? If so, how do I get the two pages in question to use that template instead of the default? is it then selectable for those pages under “Edit Page” –> Attributes –> Template?

    You can make your new page template unique by adding this to the very top of the page (no white space)

    Template Name: Your_Template_Name

    Then name the file itself:


    I believe it should then show up as a template of the same name in the drop-down area that can be applied when you create or modify a page.

    Great… Thanks for all your help and I am very close to my goal!!

    I created a new template by adding the code you described and have the pages switched over to it. I modified the code to remove the titles from those pages and it works! So, I am 95% of the way there.

    All I need to do now is remove the grey underline from those pages. Here is the code from my new template. Do you know which part I need to modify to remove the grey underline? Thanks!!

    Template Name: staticpage
    <?php get_header(); ?>
    <div id="content-body">
    <?php if ( function_exists('yoast_breadcrumb') ) { yoast_breadcrumb('<p id="breadcrumbs">','</p>'); } ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div <?php if (function_exists("post_class")) post_class(); else print 'class="post"'; ?> id="post-<?php the_ID(); ?>">
    <h2><a style="display: none;" title="<?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    <?php edit_post_link(__('Edit this page','lightword'), '', ''); ?>
    <?php the_content(''); ?>
    <?php if(function_exists('wp_print')) { print_link(); } ?>
    <?php wp_link_pages('before=<div class="nav_link">'.__('PAGES','lightword').': &after=</div>&next_or_number=number&pagelink=<span class="page_number">%</span>'); ?>
    <?php if ( comments_open() && $lw_disable_comments == "false" ) : comments_template(); endif; ?>
    <?php endwhile; else: ?>
    <h2><?php _e('Not Found','lightword'); ?></h2>
    <p><?php  _e("Sorry, but you are looking for something that isn't here.","lightword"); ?></p>
    <?php endif; ?>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    I think I just figured it out!

    The grey underline was removed by deleting the entire h2 code instead of setting it to “display: none”. Do you see any problem with doing that? There is nothing I can think of…

    Here’s the final result:

    Big Thanks to ClaytonJames!

    The underline is defined in your css at the post title h2.

    h2{background-color:#FFF;border-bottom:1px solid #DCDCDb;letter-spacing:-1px;font-size:24px;padding-bottom:3px;font-weight:400;margin:10px 0 3px 0;font-family:Helvetica, Georgia;}

    You can modify it there, which will affect ALL of the underlines under the h2 titles. Perhaps the easiest way would be to remove the entire h2 reference from your template and adjust from there. I know this seems sloppy, but perhaps one or two <br />‘s in the template itself to replace the space removed with the h2. (Boy, that seems cheesy, but it’s a quick, simple solution).

    I think you have it! Like I said, if you want some of that top spacing back, a break or two might be the easiest solution. It’s not elegant, but it will work.

    Best wishes!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Removing titles from a static page, but not all pages’ is closed to new replies.