Fix Custom Post Template Plugin for WordPress 2.9

Posted at 2:11 PM on December 20th, 2009

Odds are if you were using the Custom Post Template plugin and upgraded to WordPress 2.9, it broke. Luckily, there is a very simple fix while you wait for an official update. Navigate to your plugins directory, pop open the file named ‘custom-post-templates.php’ and find line 126. Replace the whole line with the following:

$template_data = implode( '', file( $template ) );

That should take care of it. Enjoy!

19 comments so far
  1. Leannekera says:

    Thank you very much Chris, I panicked when I upgraded and saw the post templates of the current site i am working on mess up!

    :)

  2. Paul says:

    Thanks Chris. You should post this over at themeforest too.

  3. John says:

    Oh boy, you really saved the day! Thanks so much Chris!

  4. Thanks for the fix. This was driving me insane.

  5. Indusekar SK says:

    Thanks for the fix. I shocked to find continuous error shown in the posts area.

  6. Jeff Morrow says:

    Thank you! THANK YOU! Works like a charm.

    Custom Post template is soooo essential, I just don’t understand why more people / designers take advantage of it.

  7. mT says:

    I’m getting a fatal error message for line 29. what’s the fix on that?

  8. Hi,

    Apologies for the delay in addressing this, but you should find the latest version (v1.0) addresses this issue.

    @mT – That line breaking would indicate that not all the required files for the plugin are uploaded, please try uploading the custom-post-template folder again.

    Best regards,

    Simon

  9. Kyle says:

    awesome, thanks for the fix!!

  10. Vinnie Ryan says:

    Thank you for the fix, I hope this will work fine on coming version of WP too.

  11. pez says:

    Thank you so much for pointing this out, you just saved me with a client!!

    Ciao

  12. Julien says:

    Yes !!!

    I was looking for it desesperatly,
    Thanks Chris !

  13. Justin says:

    I’m trying to activate this under WP2.9 and it triggered a fatal error:

    Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in /nfs/c04/h03/mnt/65448/domains/addsomebrown.com/html/wp-content/plugins/custom-post-template/custom-post-templates.php on line 38

    I’ve tried removing and adding again thru WP and also manually thru my ftp. Would it possible to get some help? Thx!

  14. Roscoe says:

    I am getting the same line 38 parse error as Justin.
    I am using using wordpress 2.9.2. It worked fine on my localhost, but not anymore, I have tried re-uploading several times.

  15. Nathan says:

    I get this error when installing this theme.

    Unpacking the package.

    Installing the theme.

    Theme Installed successfully.

    Warning: fopen(/homepages/14/d121321114/htdocs/trueFords/wp/wp-content/themes/themeforest_gallery-pro-2for1_54980/style.css) [function.fopen]: failed to open stream: No such file or directory in /homepages/14/d121321114/htdocs/trueFords/wp/wp-includes/functions.php on line 3598

    Warning: fread(): supplied argument is not a valid stream resource in /homepages/14/d121321114/htdocs/trueFords/wp/wp-includes/functions.php on line 3601

    Warning: fclose(): supplied argument is not a valid stream resource in /homepages/14/d121321114/htdocs/trueFords/wp/wp-includes/functions.php on line 3604

    any ideas? please help.

    Theme seems to work, also the “Submit Site” link does not show up on my install. Could it be because of this error?

  16. Nathan says:

    wow….no support here, no support through email, no support through upthemes. I like the theme(s) but not a very good business model to supply no support what so ever. I understand folks are busy and have other customers or what have you. But kind of disheartening to offer products, have support link, but then receive no support. :(

  17. Hi Nathan, are you a customer of UpThemes? If so, please post in the support forum and you will receive prompt support there.

    Unfortunately, we do not offer support for themes sold through ThemeForest because the themes are no longer being updated there.

    I hope that makes sense. Thanks for your understanding.

  18. Nathan says:

    well no I kind of dont understand, but why would I buy the theme from upthemes if I could not get my original theme to work? My first question to them/you was a pre-sales one asking if the issue exists in that theme? no response. So I asked it more directly. no response. I know you guys probably do not care about 1 guys money because you maybe sell lots of themes. But someone could at least helped me with the theme since my purchase date was about 1 week from you guys going to upthemes. So your initial offering was the same version as mine (at the time). I would love to upgrade as that is my intention, but what is being said is “pay 75 bucks to hear the answer to your question”. Which I find pretty shocking IMO. Its the same product. I just want assurance that soon as my money is paid I dont have to wait months and then hear “well you need to upgrade to this or that to get support”. Just for the record I couldnt get support when the theme was with themeforrest. But you did reply to an email about another topic which I appreciate. You seem like a nice enough fellow so I am not attacking you personally, but come on man. Are you really telling people to upgrade or go fly a kite?

Thanks for your interest in commenting, but comments are closed on this topic. However, feel free to send me an @reply on twitter.