Ready to get started?Download WordPress


Recent Posts Slider
No images because of subdomain? (5 posts)

  1. ZeroGravity
    Posted 3 years ago #

    I have WordPress installed on a subdomain and I think this is the reason the images aren't appearing. The plugin is finding the images in the posts but when it tries to resize them for the slider the image file isn't found. the subfolder is not being added to the image path. Is there an easy way to set things up for a subdomain? I have thought of:

    1) Changing every $_SERVER['DOCUMENT_ROOT'] to $_SERVER['DOCUMENT_ROOT'].'/sub-folder/'. Not desirable because when I move the site live (off the subdomain) I have to go through and remove them all.

    2) Set a global variable, with the sub-folder, at the top of recent-post-slider.php and add $_SERVER['DOCUMENT_ROOT'].$globalSubFolder. Easy change when going live. I haven't had a lot of success with globals so any advice on this would be appreciated.

    Does anyone have any other suggestions? Would there be an easier way to implement subdomain support? I suppose I could be completely barking up the wrong tree.

    Many Thanks.


  2. electrolund
    Posted 2 years ago #

    Darren, I think you're onto something here. I too am unable to get imagery loading on a subdomain install.

    Although I've been unsuccessful so far with your proposed modification. What version of the plugin did you try the above on?

  3. electrolund
    Posted 2 years ago #

    As a way of further testing, I attempted to output as text the value of $_SERVER['DOCUMENT_ROOT'] into a test variable. For instance:

    $testvar = $_SERVER['DOCUMENT_ROOT'];

    Then around line 450 in the output of the post title:

    $output .= '<div class="col">       <p>'.$testvar.'</p>   <p class="post-title"><a href="'.$post_details[$p]['post_permalink'].'"><span>'.$post_details[$p]['post_title'].'</span></a></p>';

    This doesn't seem to work either (my PHP newb-ness is showing!).

  4. electrolund
    Posted 2 years ago #

    Ok, a little update. I skipped the variable declaration and just inserted the $_SERVER['DOCUMENT_ROOT'] into the title output. It did return the path, which for me is /home4/<username>/public_html/cbe

    So the subdomain does seem to be returning correctly at the end. This has to be a bug in the path structure. I haven't tried this on a site without a subdomain yet. Have you?

  5. electrolund
    Posted 2 years ago #

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic