[wp-hackers] Fooling Wordpress To Think Plugin Output Is A Page

AdSense Templates wp-hackers at google-adsense-templates.co.uk
Mon Jan 25 02:27:08 UTC 2010


Not quite sure what you are trying to achieve.

Are these pages visible by your visitors and what you are trying to do
is get WordPress to use a different type of template to the default
one for other pages of your blog?

If so there's the inbuilt pages template selection feature. You could
use it to use a different template to the default one completely, so
rather than trying to figure out which elements to add to your custom
page and hack it into WordPress instead remove what you don't want
from a custom template file.

I use the template feature to create a sitemap for example, recently
made one that also lists the latest 300 comments and an alphabetical
list of all posts and pages. So a sitemap with recent comments.


To create the above page I made a template (copy of page.php with
changes) with some custom code and created a new page called Recent
Comments which I added no content to and selected the new page.php
based template.

Wouldn't be that difficult to have a different header.php, footer.php
files loaded instead of the default either. I'm using a plugin called
SEO Super Comments and had to make a new template based on the
single.php file which has custom code to make it work as I wanted
(didn't want comments for example) including a separate header.php
file (header2.php) so I could use a custom title element for those
pages. This page
is made with that template file and plugin.

Although I went with the same theme look I could have used any theme
for the above pages, same for the sitemap page. By doing it this way
they are WordPress pages and have all the features available a page
has (remove what you don't want via your custom template).

If I've understood what you are trying to do you might be making it
harder than it could be.

Monetize your WordPress blog with Search Engine Optimized templates
including AdSense ads http://www.google-adsense-templates.co.uk/

On Sun, 24 Jan 2010 00:42:09 +0000, you wrote:

>Dear list,
>In my plugin I interrupt template_redirect to produce my own pages via
>loading my own templates. However, to trick certain bits of the
>template into working, it would be very useful for Wordpress to think
>these are pages proper, with titles etc. Is there some internal
>Wordpress variable or set of variables I can set to do this? It would
>be especially good if I could trick the plugin generated page to think
>it was a part of the normal hierarchy of Wordpress pages, ie could
>possibly have parents etc, while not being an part of this formally.
>Thanks you for help
>wp-hackers mailing list
>wp-hackers at lists.automattic.com

More information about the wp-hackers mailing list