最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

wp admin - How to display site title with post title?

matteradmin9PV0评论

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]

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]
Share Improve this question edited Feb 9, 2019 at 0:02 fuxia 107k39 gold badges255 silver badges461 bronze badges asked Dec 1, 2012 at 17:27 4thSpace4thSpace 2671 gold badge3 silver badges9 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 4
function prepend_site_name($title) {
  return get_bloginfo('name').' - '.$title;
}
add_filter('the_title','prepend_site_name');

Like that?

Post a comment

comment list (0)

  1. No comments so far