WordPress.org

Ready to get started?Download WordPress

Forums

Delete post title from static page but not blog (38 posts)

  1. hunterdiamond
    Member
    Posted 3 years ago #

    Thanks to you fine people on Codex, I found out how to take the post title of my static pages that I'm using for my website.

    However, I want post titles for my blog which is one of the pages but not static.

    How do I get the titles on the posts but not on the static pages? What PHP file should I modify? What code does that?

    I read that I can have titles on any posts if they are categorized blog posts. But, what PHP file is that?

    Thanks.

  2. Digital Raindrops
    Member
    Posted 3 years ago #

    This is for the Twenty Ten theme but might help!

    The page and post titles often share the same class, like in twenty ten they both use the class "entry-title".

    Changing the style.css entry to display:none; is not the way to go, as you still want the search engings to see the title, and you still need post titles.

    You add an inline style in the page.php and single.php files, like:

    <h2 class="entry-title"></h2>

    This changes to:

    <h2 class="entry-title" style="display:none;"></h2>

    HTH

    David

  3. hunterdiamond
    Member
    Posted 3 years ago #

    David - thanks so much for the reply. I used Artisteer to design the template. I went into the PHP files you suggested in WordPress.

    But, I can't figure out where to place the text. In page.php file, I saw h1 but not h2. Does that work in there?

    thanks,
    Anne

  4. pauledward
    Member
    Posted 3 years ago #

    I have the same question. I have several static pages (Home, About, Blog, Contact, etc.) where I don't want the page titles to appear. So I've used the display:none in my styles.css.

    But I DO want my titles to appear on the Blog posts.

    I've tried the above suggestions, but, like Anne, I'm not sure exactly to put the line of code in the page.php file.

    Any further suggestions will be helpful.

    Paul

  5. govpatel
    Member
    Posted 3 years ago #

    If you using twenty ten theme and its there

    <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    					<?php if ( is_front_page() ) { ?>
    						<h2 class="entry-title"><?php the_title(); ?></h2>
    					<?php } else { ?>
    						<h1 class="entry-title"><?php the_title(); ?></h1>
    					<?php } ?>
  6. hunterdiamond
    Member
    Posted 3 years ago #

    govpatel,

    I'm not using twenty ten theme. So, if I use this code, where do I put it? What part or php file does it go into???

    thanks.

  7. govpatel
    Member
    Posted 3 years ago #

    Paste your page.php file in http://wordpress.pastebin.com so that can see what you have.

  8. pauledward
    Member
    Posted 3 years ago #

    Thanks for the assistance. I'm using Thematic theme and found the answer to my question on the Thematic forum. Once I found the right code to paste into my functions.php file, it works as I'd hoped it would.

    Thanks again.
    Paul

  9. hunterdiamond
    Member
    Posted 3 years ago #

    govpatel - I already know what template I'm using. I'm using Artisteer to create my templates. When I go to the WordPress.pastebin.com, what am I doing there?

    Then what? Again, what php file should I put this code into?

    Pauledward - would you share what you did, what the code is for you?

    I'm sorry if this is increasingly frustrating but I've been waiting for close to 3 days with no resolution. I'm shocked that anybody replied. The reply rate is often 50% or less.

    Thanks,
    Anne

  10. pauledward
    Member
    Posted 3 years ago #

    Anne, I'm with you on the frustration part. I finally found what I was looking for on the Themeshaper forum.

    What I did may be specific to the theme I'm using, that is, Thematic.

    I put the following code in my functions.php file. That did the trick. It kept the page titles off the static pages yet kept the post titles on the blog page.

    It's worth a try.

    [Code moderated as per the Forum Rules. Please use the pastebin]

  11. pauledward
    Member
    Posted 3 years ago #

    Sorry about the way the code looks. I forgot to mark it up.

    [Code moderated as per the Forum Rules. Please use the pastebin]

  12. hunterdiamond
    Member
    Posted 3 years ago #

    pauledward - thanks so much. Did you remove any code? And, where did you paste this in the php? In my file, there are over 500 lines of code for this.

    Thanks again. You're a peach.

  13. pauledward
    Member
    Posted 3 years ago #

    I know absolutely nothing about php code other than copy and paste. I found this code on the Thematic forum. Thematic is the theme I use. Look for the functions.php file and past the code in it. Go to the end of the file and paste the code right before the ?>.

    If it works, great. If not, well...

    This code may be theme-specific. If so, you may have to ask the author of the theme you're using. If it's twenty-ten, this seems the right place to ask the question. Maybe you'll have to try again.

    Paul

  14. nikkidev
    Member
    Posted 3 years ago #

    I'm using the twenty ten theme and have a static 'Home' page as my frontpage. I don't wish to have the 'Home' title appear on my frontpage but do wish to have titles on all my other pages and post pages. Any ideas?

  15. hunterdiamond
    Member
    Posted 3 years ago #

    nikkidev - the easiest route is to got to Appearance and click on Editor. You'll have a list of the different PHP files.

    Go to post_title.php and delete or save elsewhere the code. Leave it empty.

    Now you deleted the title on every page.

    Then, I went back to my website and put a title on every page using a header format. It's in a fixed place on each page and don't have to worry about the follow link showing through.

    Unfortunately, it also removes titles from you blog posts. So, I do the same and embed a title in my blog posting at the top until I find a work around.

    It's an imperfect solution for now. It was either that or get hung up forever.

    Govepatel's posting above is an another way to go and includes the code if you change the Twenty Ten layout.

    cheers,
    anne

  16. LJagermaster
    Member
    Posted 3 years ago #

    @pauledward - I was just about to try this hack myself and something jumped out at me - the word "thematic" has been used a couple of times in the code you posted, which is a strong implication that it is a theme specific hack. However, many themes function in almost identical ways, it's just they're physical appearance that differs, so unless it can be confirmed to work on other themes without causing other issues it's probably best not to try it out (I've tried out various "trial & error" hacks in the past and some have caused major damage to the site, so it's really not worth it unless you have the time to restart from scratch).

    The site I'm working on just now is using a customised version of the Grunge Style theme so I'm definitely not going to try it until I know for sure... :-/

  17. Rob
    Member
    Posted 3 years ago #

    Omitting titles on certain pages like the homepage can be problematic from a search engine standpoint if you are simply removing it in the post_title.php file. This is because the title tag is an important component of that SEO equation.

    I would recommend that to hide titles on specific pages/posts using the Post ID and a bit of CSS to make it dissappear. For example if you had a post ID of "5" for your homepage you could include a simple line of code in your style sheet such as:

    .post-5 h1 {display:none !important;}

    Doing this will essentially make that header with the assigned style h1 invisible on only the page with the post ID of "5". The only variable here would be the post ID number. So if you had a post ID of "15" that would be the ID you would want to include in the new CSS Style. The reason I included !important in the string is so that the new CSS code is forced to override any other code in your stylesheet.

    Just a note: I have used this with great success on several premium themes and theme frameworks but have not specifically tried this method with the TwentyTen theme.

  18. LJagermaster
    Member
    Posted 3 years ago #

    Just curious, wouldn't that also hide the title from the post itself? I'm unsure as to how that will effect post lists such as archives etc... :-/

    SEO isn't a real issue for us as we're using the Platinum SEO plugin (successor to the All In One SEO plugin) so we've got all that taken care of.

    Thanks tho Rob for your reply, much appreciated. I guess I'm just a born skeptic! X-D

  19. Rob
    Member
    Posted 3 years ago #

    Yes, it will. Maybe I misunderstood the intent of this topic. The post title may have thrown me. I was under the impression that we were looking for a way to strip the title visually from a static page but not from posts. The method I discussed above will do just that. However, it will remain in the source code for the page which is good for SEO so long as it is titled something relevant to the pages content. Sorry if I mislead you. Hopefully the information is useful to someone out there.

  20. rextherunt
    Member
    Posted 2 years ago #

    Thanks for posting your solution - it's exactly what I'm looking for. I tried pasting the code you provided into my functions.php file and it crashed my site. I'm still testing on my local machine, so it's OK. I tried it on another test site with a different theme, and this time it didn't crash, but the php just appeared "above" the page.
    Is there somewhere specific it's supposed to be pasted?
    I'd really like to get this working, as I can't expect my client to add to the css every time they create a new page.
    Thanks!

  21. Rob
    Member
    Posted 2 years ago #

    Not sure if the comment above was directed at me. There are many methods to "delete a post title from a static page" that are discussed here. The method I mentioned above assumes you are trying to visually hide the title on a single static page rather than the entire site. The code I provided was was intended for use in your style sheet only! Changes to the CSS file impact the front end look and feel but do not alter any back end functionality. Therefore, they can easily be reversed by removing the style. Changes to the functions.php file can indeed wreak havoc if not done properly. If you are trying to hide the title globally you may be able to achieve this by altering the code in your single.php file but the CSS method described above is not how this is generally handled and the solution may vary depending on how your theme was coded.

  22. rextherunt
    Member
    Posted 2 years ago #

    Thanks for your response Rob. I've looked everywhere for a css solution to removing page titles globally but not post titles. It seems that it's fairly easy to remove both. In my theme (a modified twentyten) there seems to be no distinction between posts and pages.
    Can you suggest any leads to follow?
    Thanks!

  23. Rob
    Member
    Posted 2 years ago #

    Give this a try. You said you were working off of a modified twenty ten theme. Go into your page.php and replace everything that is in there with the following code.

    [Code moderated as per the Forum Rules. Please use the pastebin]

  24. Rob
    Member
    Posted 2 years ago #

    Sorry forgot to end my code tag:

    [Code moderated as per the Forum Rules. Please use the pastebin]

  25. Rob
    Member
    Posted 2 years ago #

    That should keep titles on your blog post pages but remove them from all the static pages. Not sure what this will do as far as SEO goes by completely removing the title tag but nonetheless it is a method worth trying.

  26. rextherunt
    Member
    Posted 2 years ago #

    Hi Rob
    Thanks for this. I'm not sure I want to remove everything else - there's a lot more in there, and I'm nervous to replace it. It's actually a twentyten theme modified to inherit Joomla styles as I'm using WP as a component. Is there no css-only solution, or something like a custom field method that can be added on the front end by a user without going into the php?
    I appreciate your time!

  27. Rob
    Member
    Posted 2 years ago #

    Take a look at the original Twenty Ten page.php file and you will be able to figure out what has been added to your theme and what was original. There is not much in the original so I am assuming that your theme has been customized quite a bit.

  28. Rob
    Member
    Posted 2 years ago #

    As far as I can tell there is no easy way to target the headers/titles for post and pages separately on a global basis using a CSS only solution. You can only do it for individual post IDs but as you mentioned earlier that really isn't a feasible option for what you are trying to achieve. Wish I had a better answer for you.

  29. mwrmwr
    Member
    Posted 2 years ago #

    I've read all these messages and still don't know how to remove the page titles from pages (but leave blog post titles) with the twenty ten theme. FYI, my page.php file contains very little code.

  30. govpatel
    Member
    Posted 2 years ago #

    Paste your page.php code in http://wordpress.pastebin.com and paste url here so we can see the code.

Topic Closed

This topic has been closed to new replies.

About this Topic