0

Is it possible to have the site title prepended before each post title, separated by a hyphen? For example:

[my site title] - [my post title]
4
function prepend_site_name($title) {
  return get_bloginfo('name').' - '.$title;
}
add_filter('the_title','prepend_site_name');

Like that?

| improve this answer | |
  • Ok, thanks. If it can't be done in the WP admin, I'll need to see how this translates into Thesis 2's non PHP platform. – 4thSpace Dec 1 '12 at 17:45
  • If you don't mind using a plugin, you could install Yoast SEO plugin. This will also add a ton of other SEO features you might not want, so before you install please inform yourself on this plugin. If you do decide to use this plugin anyway: Just enter your desired settings under "SEO >> titels & meta's" In your case: > %%sitename%% - %%title%% – bertkat Dec 11 '12 at 13:11
  • Given that Yoast SEO simply filters the_title, using the method described in the accepted answer, this really doesn't provide a different answer, and would probably be better as an edit or comment to the accepted answer. – Chip Bennett Dec 11 '12 at 13:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.