WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Single Post Template] Warning: ... failed to open stream in wp 2.9 beta 2 (11 posts)

  1. sebmeric
    Member
    Posted 4 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/

  2. Oscar
    Member
    Posted 4 years ago #

    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

  3. vsellis
    Member
    Posted 4 years ago #

    Likewise, I sent an email to Nathan as well. Let's see what comes back.

  4. vsellis
    Member
    Posted 4 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.

  5. Illi.Pro
    Member
    Posted 4 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 :)

  6. studiograsshopper
    Member
    Posted 4 years ago #

    The fix posted by vsellis will work, but it's not backwards compatible and therefore will ONLY work with WP 2.9.

  7. sebmeric
    Member
    Posted 4 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 ) );
  8. sebmeric
    Member
    Posted 4 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 ) );
  9. nathanrice
    Member
    Posted 4 years ago #

    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

  10. Coffeecup
    Member
    Posted 4 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 =)

  11. sommerinhamburg
    Member
    Posted 4 years ago #

    Worked! Thanks folks!
    In my case in: wp-admin/includes/theme.php

Topic Closed

This topic has been closed to new replies.

About this Topic