My current <title>
tags are like this:
Blog post title | Site name
How do I remove “Site name” so that the <title>
tags will be like this:
Blog post title
Except, of course, on the front page, where the <title>
tag should be:
Site name
Please take into account that I’m a complete WordPress newbie.
Edit: Here’s my current <title>
tag from header.php
:
<title>
<?php
if ( defined( 'WPSEO_VERSION' ) ) {
// WordPress SEO is activated
wp_title();
} else {
// WordPress SEO is not activated
wp_title( '|', true, 'right' );
}
?>
</title>
The best (and easiest) thing to do is to use the
wp_title
filter.First, clean up your call to
<?php wp_title(); ?>
in your template. Replace what you have with this:Then, in
functions.php
(or in a child Themefunctions.php
; normal caveats apply), add the following:This filter will completely overwrite the
$title
output in single-page contexts. (The actual conditional is taken directly from core, from thewp_title()
function definition itself.)Last I checked, WordPress doesn’t actually output the site title anywhere in
wp_title()
; so if you’re seeing that, something is adding it (perhaps your Theme?). Nevertheless, if you want to output it, just write a complimentary conditional in the above filter; e.g.:Add this line in your header.php file
Add Below code in theme’s functions.php file
Reference:http://codex.wordpress.org/Plugin_API/Filter_Reference/wp_title
On my template file header.php I replaced the title line by this
In my case I am using a woothemes template, that’s why that woo_title() output.
Here, you can check in a single line if you are on home page, if true, you can allow to display the blog/site title, if false output the title without the site name, just will display your post or page title.
i was haveing this issue with posts so i searched the interet and i made a little plugin that remove the blog name from the posts
please notince this code
it only applies to posts title
you can add more codition like
here i added archive pages too
i hope you got a general idea of how it works
easiest way Ive found is in WordPress Settings tab, remove the “Title” of your site. Not the most programmatic, but easiest.
Try this and also read more here
|
indicates vertical bar as separator. true argument stands for $display, whether to display the title or no. Third arugment is position where to put separator.