Forums

[resolved] Function file_exists() does not work in my WordPress (6 posts)

  1. fjvasselai
    Member
    Posted 2 years ago #

    Anyone could help me with that?

    I am trying to put a detection of files in each post, i.e., inside the main loop. But it does not work: file really exists, but I still got the result that it does not.

  2. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    It's probably a path issue. What exactly are you using?

  3. fjvasselai
    Member
    Posted 2 years ago #

    Thank you for your attention!

    I realized that it works if I use something like:

    file_exists('directory/file.any')

    But not if I use:

    file_exists('http://myblog.com/directory/file.any')

    Is there anyway to pass the function tag in this second way?

  4. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    file_exists requires a file path - not a url. Is the file on your server?

  5. fjvasselai
    Member
    Posted 2 years ago #

    Yes, it is on my server.

    But what is it was not, could it be possible to detect it by any other means?

  6. iridiax
    Member
    Posted 2 years ago #

    Try putting the files in your current theme's folder and using TEMPLATEPATH. file_exists works for me this way.

    http://codex.wordpress.org/Include_Tags#Including_Any_Template

Topic Closed

This topic has been closed to new replies.

About this Topic