Support » Fixing WordPress » Warning: implode() [function.implode]:

  • Resolved jeffqc


    ive this s line all around wordpress dashboard since ive install the new 2.9 version
    Warning: file(/home/stripper/public_html/ [function.file]: failed to open stream: No such file or directory in /home/stripper/public_html/ on line 23
    Warning: implode() [function.implode]: Invalid arguments passed in /home/stripper/public_html/ on line 23

    //This function scans the template files of the active theme,
    //and returns an array of [Template Name => {file}.php]
    if(!function_exists('get_post_templates')) {
    function get_post_templates() {
    	$themes = get_themes(); //an array of all themes in the /themes directory
    	$theme = get_current_theme(); //the current, active theme
    	$templates = $themes[$theme]['Template Files']; //a list of all the current theme's template files
    	$page_templates = array ();
    	foreach ((array)$templates as $template ) { //this loop returns all the "post templates"
    		$template_data = implode( '', file( WP_CONTENT_DIR.$template ));
    		$name = '';
    		if ( preg_match( '|Single Post Template:(.*)$|mi', $template_data, $name ) ) { $name = $name[1]; }
    		if ( !empty( $name ) ) { $post_templates[trim( $name )] = basename( $template ); }
    	return $post_templates; //return the array of Post Templates
Viewing 15 replies - 1 through 15 (of 18 total)
  • And what happens if you switch theme?

    this is a bug with the them but the problem is that i need this theme 🙁

    What line is line 23 then?

    I’m getting the same problem since switching to 2.9 – get it with one theme but not others. I haven’t changed the theme that causes the error. Here’s the error message:

    Warning: implode() [function.implode]: Invalid arguments passed in /home/mindwor1/public_html/wp-content/themes/agent_20/tools/post_templates.php on line 23

    The theme in question seems to function properly, but this makes a real mess of my dashboard and I’m concerned that there are other problems lurking in there somewhere that I haven’t discovered yet.

    The problem is this line here, it’s setting an incorrect path.

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

    Try updating that to..

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

    Not sure it will help, but worth a shot i guess.

    Hi JeffQC,

    hm, I’m having the exact same issue with the exact same Theme. Since this is a premium theme I really hate to dump it for a new theme (Metro 1.0). Were you able to resolve it and if so, could you share how, or anyone else please? Thank you:)

    Interesting, looks like both themes in question here are Studiopress premium themes. Metro and Agent. What to do… If I figure it out I’ll repost.

    SUCCESS!! THANK YOU T31os_!!!

    What ya do is correct that line as instructed above the post_templates.php file, save, refresh, et walla:) whewwwwwww 🙂

    I just copied the code you provided, printed out the variables, the problem was quite evident..

    You may want to pass the information along to the author, so he can fix the problem.. if he’s not released an update already.

    And you’re welcome… 😉

    t31os_ thank you problems solved

    I’m having this exact same issue, and I did apply the fix t31os_ provided, but I’m now using version 2.9.1 and it’s not working. Cleared my cache, etc… and still getting the error within the wp dashboard area only, not on the web.

    Any other suggestions?


    Hi Traci,

    Can you provide the error message?

    We are quite aware of this 2.9 issue and had the resolution in our support forum the day 2.9 was released. If you are a Member you would have seen this.

    Agent or Black Canvas:

    {easy way}
    1. Find the Post Templates plugin in your Plugin manager and use the update function to update it to the latest version.


    {hard way}
    1. Download the latest version from the plugin repository

    2. Deactivate the Single Post Template plugin in your Plugin Manager via the Admin panel.

    3. Delete the old version

    4. Upload or install the latest version (1.3)

    5. Reactivate the plugin

    Metro theme:

    1. Download the latest version from the plugin repository.

    2. You MUST delete the post-templates.php file in the /metro_10/tools/ folder.

    3. Upload the new (1.3) post-templates.php file to the folder named in step 1.

    That’s it.

    If you are a Member you would have seen this.

    So i take it this problem relates to a premium theme then.

    Lucky this forum’s support is free i guess.

    ive buy the highly custome template for Twitter from ebay.
    now the video doesnt not appear at the right of the page( aside the tweet)

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Warning: implode() [function.implode]:’ is closed to new replies.