[wp-hackers] is it possible to change the_title halfway into the processing of a page/post?
wordpress at zed1.com
Wed Feb 22 20:47:17 UTC 2012
On Wed, Feb 22, 2012 at 18:08, Haluk Karamete <halukkaramete at gmail.com>wrote:
> Thanks Mike.
> With your solution though, when I switch themes, wouldn't all that
> custom programming ( querying the db to get the record data / title
> etc ) be not accessible?
Yes you are right; and that is the criteria I use for choosing whether code
should go in functions.php or a plugin: "If I want to change themes, will
So in this case the answer is "yes", so you need to put that code in a
The template_redirect hook,
And the db access and display functions.
Add a hook for wp_title
add a hook for the_title
add a hook for 'the_content', that calls your display functions.
That way, any theme that calls the_content on your page will be get your
It was quicker to knock up an example than to explain the details. See
Hope that helps.
More information about the wp-hackers