WordPress.org

Ready to get started?Download WordPress

Forums

Hide Single Page Title Using CSS Display None - Help (9 posts)

  1. cbryant
    Member
    Posted 5 years ago #

    My goal is simple.

    I would like to hide the H2 Page Title from only one page (the landing page) of my site.

    I've read numerous posts saying I should be able to do this using something like this:

    #page-id h2 {display: none;}

    The only problem is I don't know "exactly" how that should look.

    I know the ID number of my page is 183

    But I don't know if I'm to write "#page-id-183...", or "#page183".

    Has anyone out there successfully hidden the TITLE of a single page from your wordpress site using this method.

    Afterthought: I did try hiding ALL h2 titles using display none and it did work...so, I know I'm close. But...(help)?

  2. jasbeattie
    Member
    Posted 5 years ago #

    Hey I was also trying to do this and came across your post....

    Try this:

    #post-183 h2 {display: none;}

    It worked for me!

  3. Jon Henwood
    Member
    Posted 5 years ago #

    didn't work for me...

  4. urbancoder
    Member
    Posted 4 years ago #

    If you're only trying to hide the title individual pages you can just add this to the HTML portion of the page post:

    <style>
    .post-title
    {
    display: none !important;
    }
    </style>
  5. tonyeldridge
    Member
    Posted 4 years ago #

    This was able to remove the word "Home" from my main page:

    #post-33 h2 {display:none;}

    But when I add other lines, replacing the 33 with the new page's ID, it doesn't work. I also tried urbancoder's code and it did not work.

    I am trying to remove the titles from all my static pages. Any other suggestions or ideas on what I may be doing wrong?

  6. S.K
    Member
    Posted 4 years ago #

    @tonyeldridge

    If your aim is merely to remove the title from all your static pages, you can delete this line from page.php template of your theme:

    <h2><?php the_title(); ?></h2>

    S.K

  7. S.K
    Member
    Posted 4 years ago #

    @jon73,

    If your theme's page template has the following (or, similar) markup, it has to work:

    <div class="post" id="post-<?php the_ID(); ?>">
    <h2><?php the_title(); ?></h2>

    S.K

  8. cronos01101x5
    Member
    Posted 4 years ago #

    sorry if I am posting this so long after the last post in this topic, but I found another solution. simply add the following CSS code to the body of your page post.

    <style>
    .Post-Title {display:none;}
    </style>

    in other words. When you add a new page, click the html view tab, and put that code at the top, update, and you're done.

  9. meta-bee
    Member
    Posted 4 years ago #

    kichu has got it right - deleting that line of code works like a charm. Safety tip: before you delete ANY code, copy and paste it into notepad so you can put it back if you need to.

Topic Closed

This topic has been closed to new replies.

About this Topic