AndrewBanchich
Member
Posted 3 years ago #
I use the Evidens theme on my blog (http://ragnarockmusic.com/). In the header php file it has "<title><?php bloginfo('name'); ?><?php wp_title(); ?></title>" for the titles of pages. As you can see, if you go to a single post it shows the blog name, a "»" tag, and the title of the post. However, I don't want to » tag. How do I remove it?
Hi AndrewBanchich.
A straightforward solution would be to replace the contents between the <title> tags with the following:
<?php if ( is_single() ) { echo get_bloginfo('name') . ' | ' . wp_title(); } else { echo get_bloginfo('name') . ' | ' . get_bloginfo('description'); } ?>
The above code will print the title as "BLOG NAME | POST TITLE" for single post pages and "BLOG NAME | BLOG DESCRIPTION" for all other pages. This IF statement can be expanded upon using other WordPress conditional tags.
I hope this helps. :)
AndrewBanchich
Member
Posted 3 years ago #
Wouldn't that still show the »? It seems as though the theme creator put the » sign into the wp_title tag somehow, so it shows up wherever you have the wp_title tag.
If you look through the functions.php file, is there anything that calls wp_title()? Possibly an add_action() with it in?
If you search through your theme's functions.php file (an any files linked to it via a require() or include() statement) and comment out any lines with wp_title() in them, that should, as I understand it, resolve this.
This is the first time I've seen this issue, so I'd imagine it's a customisation within the theme you're using.
:)
AndrewBanchich
Member
Posted 3 years ago #
I looked there at first and there was nothing about wp_title
Is there any reference to » at all? Perhaps in single.php as that's where the page is treated differently?
AndrewBanchich
Member
Posted 3 years ago #
None whatsoever. I did a Command+F on it and nothing showed. Is there some deeper file that wp_title pulls the info from? It could be there...
killermanic
Member
Posted 3 years ago #
Hi, try wp_title('',true)
neilwill
Member
Posted 3 years ago #
I managed to get this to work using a combination of mattyza and killermaniac's code.
For the article title immediately following the blog title:
<?php if ( is_single() ) { bloginfo('name') ?> <?php wp_title("",true); } else { echo bloginfo('name') ?> <?php bloginfo('description'); } ?>
To use other separators in place of ยป such as | just place them between the ?> <?php
Or use something like wp_title('|',true,'right')
http://codex.wordpress.org/Template_Tags/wp_title
thinkadrian
Member
Posted 3 years ago #
I'd like these options, how do I get item #2?
1) on a category page
Category title | Site Name
2) on a single page
Page Name | Category title | Site name