WordPress.org

Support

Support » Plugins and Hacks » [Plugin: Single Post Template] Warning: … failed to open stream in wp 2.9 beta 2

[Plugin: Single Post Template] Warning: … failed to open stream in wp 2.9 beta 2

  • 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/

Viewing 10 replies - 1 through 10 (of 10 total)
  • 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
    Participant

    @vsellis

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

    vsellis
    Participant

    @vsellis

    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.

    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 🙂

    studiograsshopper
    Member

    @studiograsshopper

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

    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 ) );

    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 ) );
    nathanrice
    Member

    @nathanrice

    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

    @coffeecup

    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 =)

    Mark Max Henckel
    Participant

    @sommerinhamburg

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

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘[Plugin: Single Post Template] Warning: … failed to open stream in wp 2.9 beta 2’ is closed to new replies.