homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Content Management
Forum Library, Charter, Moderators: ergophobe

Content Management Forum

wordpress + custom code issues?

 6:52 pm on May 10, 2010 (gmt 0)

I want to use a CMS and I'd rather not have to design one from the ground up. I like wordpress from what I've seen. The thing is, I'll still definitely want to execute my own code. I know there are plugins do to this.

1) How much overhead would they cause? Do you have specific recommendations for which to use?

2) How would something like php code affect plugins like WP super cache? Would it cache the results or..? Is there any way to control if it caches them or not?

3) Custom pages wouldn't be too big of an issue... site.com/mycustompage would work fine as far as I can tell. the issue comes with things like pagination. Would wordpress think site.com/mycustompage?page=2 is a different page entirely? Is there any way to control something like that?

Any general tips/warnings for someone that wants to use wordpress in this way?



 4:05 pm on May 11, 2010 (gmt 0)

I can't answer a lot of those. I've run custom PHP from within Drupal, but it's more setup for that sort of thing (so in other words, I've let drupal handle the general page layout and nav and had some pages that had custom PHP, usually just a few lines that include() the needed files).

Overhead is what overhead is. In the case I mentioned above, it was dead slow. I profiled it and found out that, of all things, a dozen calls to GetImageSize() was burning huge numbers of CPU cycles.

I have no idea how Supercache works. In the drupal example I gave above, I created custom caching for the custom PHP parts, simply using output buffering, saving the output and then checking for it on each request before trying to regenerate.

Finally, on URLs. I'm not sure I'm following what you're thinking in terms of implementation, but here's at least a discussion starter.

By default, WP rewrites everything to index.php. So example.com/mycustompage would require a rewrite rule that says *not* to rewrite that, but to handle it outside WP. So the simple thing to do would be to have custom pages all have a prefix like /custom/ and just have one rule that would catch all of those.


 6:36 pm on May 14, 2010 (gmt 0)

is there no way to handle a page inside wordpress but still allow pagination/get variables/variables passed by url?

I want site.com/page to be handled by wordpress, but be able to execute custom code within it. this can be done by a number of plugins.

the problem comes when I try to do something like site.com/page?p=2 or site.com/page/2 since wordpress thinks those are entirely separate and unrelated to site.com/page


 8:01 pm on May 14, 2010 (gmt 0)

I'm not saying it can't be done. I'm saying I've never done it. Big difference.

It should be simple enough to test it. Create a simple page that has some PHP executing on it and see how Supercache handles it.


 9:02 pm on May 14, 2010 (gmt 0)

yep, i tested supercache already. it does cache the php code. it'd nice to be able to control that directly but that i can work around.

i really have no idea to handle the variables passed by url problem though


 12:11 am on May 15, 2010 (gmt 0)

Ah right. I see what you're driving at. The problem is that you are using GET params in your custom PHP code, and that's creating problems for WP, because WP wants to handle all URLs itself and not let you send your vars.

I did this search in google

And several helpful pages came up. Poking around the first five results or so seemed like between them, you'd have a solution.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Content Management
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved