sebmeric
Member
Posted 2 years ago #
Hi,
I was using this great plugin with wp2.8.4 with no problem and i thought i'll test it width the 2.9 beta 2... and i had this warnings :
Warning: ... failed to open stream: Invalid argument in ... post_templates.php on line 23
Warning: implode() : Invalid arguments passed in ... post_templates.php on line 23
Don't know if it comes from wp, from the plugin itself, or from me (!) but maybe someone will :)
localhost / win XP / EasyPHP5.3.0 (apache 2.2.13/mysql 5.1.37/php 5.3.0)
Thank you,
Séb.
http://wordpress.org/extend/plugins/single-post-template/
I have been using this plugin with the latest WP 2.8.6 and have been very pleased with it.
However with WP 2.9 I also have had the same issue as the previous post.
Warning: ... failed to open stream: Invalid argument in ... post_templates.php on line 23
Warning: implode() : Invalid arguments passed in ... post_templates.php on line 23
vsellis
Member
Posted 2 years ago #
Likewise, I sent an email to Nathan as well. Let's see what comes back.
vsellis
Member
Posted 2 years ago #
Looks like changing line 23 from
$template_data = implode( '', file( WP_CONTENT_DIR.$template ));
to
$template_data = implode( '', file($template ));
will remove the error. Not sure this is a good long term fix but might get you running for now.
Illi.Pro
Member
Posted 2 years ago #
I also sent a mail to Nathan but.. any response :(
i don't know if the solution of vsellis would be good.. but thanks anyway vsellis :)
The fix posted by vsellis will work, but it's not backwards compatible and therefore will ONLY work with WP 2.9.
sebmeric
Member
Posted 2 years ago #
hi,
thanx for your answers.
vsellis hack works actualy pretty well.
@studiograsshopper : for backward compatibility issues, you may use this :
// cache the WordPress version for calculations
// see : http://www.eliperelman.com/?p=91
$wpversion = ( float ) substr( get_bloginfo( 'version' ), 0, 3 );
if ( $wpversion < 2.9 )
$template_data = implode( '', file( WP_CONTENT_DIR.$template ) );
else
$template_data = implode( '', file( $template ) );
sebmeric
Member
Posted 2 years ago #
hummm...
maybe it's better to use the php function version_compare :)
global $wp_version;
if ( version_compare( $wp_version, '2.9', '<' ) )
$template_data = implode( '', file( WP_CONTENT_DIR.$template ) );
else
$template_data = implode( '', file($template ) );
Guys,
Version 1.3 solves any issues with 2.9. It also ensures 2.8 backward compatibility, but I would not recommend staying on 2.8.
Hopefully that helps.
Nathan
Coffeecup
Member
Posted 2 years ago #
I experienced the same symptoms described above after upgrading to WordPress 2.9.
Just downloaded and installed the update version of this plugin. Seems to be working like a charm, i.e. plugin version 1.3 with WP version 2.9.
Thanks for the author, good work =)
sommerinhamburg
Member
Posted 2 years ago #
Worked! Thanks folks!
In my case in: wp-admin/includes/theme.php