[wp-hackers] is it possible to change the_title halfway into the processing of a page/post?

Haluk Karamete halukkaramete at gmail.com
Wed Feb 22 18:08:40 UTC 2012

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?

The reason I was putting the php code right there where the exec_php
runs ( that is the_content section ) was to store this in the wp_posts
as content so that when I switch themes, no matter whivh theme I
switch to the output of ...com/permalink/page would be the same -
except theme specific cosmetics.

But could the issue I'm raising with this be addressed by making sure
all themes functions.php **include** a generic_functions.php from the
wp root so those hooks kick in across the board?

On Wed, Feb 22, 2012 at 1:44 AM, Mike Little <wordpress at zed1.com> wrote:
> You need to detect the query strings in the url early on in the process as
> previously demonstrated to you. Do that with a template_redirect hook in
> your theme's functions.php
> But to do your actual processing, create a page template and fill that with
> your display code, assign that template to your special page.
> So:
> * on the template_include hook detect your query vars,
> * if detected query your db, calculate your title (cache the db results)
> * set up the_title filter to return your desired title OR just add some
> code to header.php to use your different title
> *in the page template, output the results of your earlier db query.
> Mike
> --
> Mike Little
> http://zed1.com/
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

More information about the wp-hackers mailing list