Support » Plugin: classyfrieds » [Plugin: classyfrieds] "failed to open stream" error.. why??

  • Resolved silasneo


    Hello admin.

    thanks for this great plugin.
    I tried listing some stuff and then i got this error message:

    Warning: file_get_contents(MY_DOMAIN/wp-content/plugins/classyfrieds/themefiles/listing_2_columns.php) [function.file-get-contents]: failed to open stream: No route to host in MY_PATH/wp-content/plugins/classyfrieds/themefiles/classyfried_listings.php on line 35

    why is this happening? and how can i fix it please?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author



    this makes absolutely no sense if you are running the latest version. (2.6)
    line 35 in classyfried_listings.php reads :
    $layout = file_get_contents(plugins_url('/layouts/'. $cfo['listing_layout'] . '.php', __FILE__) );

    this clearly indicates we are looking for a file path with /LAYOUTS/ included in it, however your error message states :

    while it should read :

    if you are comfortable with the code editor what do lines 34-36 of your plugins/classyfrieds/themefiles/classyfried_listings.php say ?

    Did you try re-installing and flushing the plugin ?

    Did you by any chance modify any code on the plugin ?
    If not, please send me a private mail as I’d be very interested to see what is going on. info at

    Hi there

    Thanks for your reply..
    Your observation about the missing “LAYOUTS” was right… when i got this error on line 35, i attempted to fix it by removing the “LAYOUTS” but i have restored the code to the original form (version 2.6), so here is the present statement of the error:

    Warning: file_get_contents( [function.file-get-contents]: failed to open stream: No route to host in /hermes/bosweb/web241/b2413/nf.ekoconnectcom/public_html/wp-content/plugins/classyfrieds/themefiles/classyfried_listings.php on line 35

    I also did some research online and i read somewhere in stack overflow that this error may be related to the allow_url_fopen setting in my php.ini file.. mine is currently set to “off” , is this a problem?

    Plugin Author


    GOOD CATCH, although technically not wrong I did use a URL call when a local path is preferred. You are correct that allow_url_fopen will block access to URL’s in this case.

    There are actually 3 different files that make similar calls, I will implement changes in the next update.
    In the meantime I would love to hear if the following changes work for you :

    Replace the lines with ‘file_get_contents’ as follows.
    classyfried_listing.php line 35
    $layout = file_get_contents(plugin_dir_path(__FILE__) . 'layouts/'. $cfo['listing_layout'] . '.php' );

    single_classyfrieds.php around line 34
    $layout = file_get_contents(plugin_dir_path(__FILE__) . 'layouts/'. $cfo['listing_layout_single'] . '.php' );

    cats-listing.php around line 37
    $layout = file_get_contents(plugin_dir_path(__FILE__) . 'layouts/'. $cfo['listing_layout_taxonomy'] . '.php' );

    In the meantime send me a PM and pick out a free commercial expansion from … good feedback and error-reporting needs to be rewarded.


    Thanks for your tweak.. it worked remarkably well, the error has been fixed.

    Many thanks

    PS; thanks for the free expansion pack, how do i send send you a PM please?

    Plugin Author


    good to see it works. version 2.7 has been updated with these changes and is now available.

    mail me at the following address: info at

    I tried to add 2 field into the form page by editing the page-classyfried_add_listing.php inside themfiles folder and…failure!

    add_post_meta($the_new_id, 'price', $_POST['prijs'] , TRUE);
    			add_post_meta($the_new_id, 'city', $_POST['city'] , TRUE);
    			add_post_meta($the_new_id, 'cregion', $_POST['zip'] , TRUE);

    How can this beautiful plug in for classified ads has no city and phone field? How can local publisher use this with minimum function,,,? but should be upgraded to premium?

    I put the dropdown menu for the zip by adding this code and looks like runs well

    <?PHP // zip or region
    		if ($cfo['form_zip'] =="on") { ?>
    		<div class="lefty">
    			<?PHP echo $cfl[f_zip]; ?>
    		<div class="righty">
    			  <select id="zip" name="zip" class="inputy" maxlength="50">
    			<option value="">....Pilih Propinsi .....</option>
    			<optgroup label="JABODETABEK">
    			<option value="DKI">Jakarta</option>
    			<option value="Bogor">Bogor</option>
    			<option value="Depok">Depok</option>
    			<option value="Tangerang">Tangerang</option>
    			<option value="Bekasi">Bekasi</option>
    			<optgroup label="Jawa">
    			<option value="Banten">Banten</option>

    Plugin Author


    try first to modify an existing form field (like the year/make/model) , that’s easier than adding a new form field. Form fields and the text that goes with it are hard coded and referenced throughout.

    It’s not enough to just edit one .php file.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: classyfrieds] "failed to open stream" error.. why??’ is closed to new replies.