Help with a php if file exist and page slug
-
Could someone please put together an if to:
Check if in wordpress image folder there is an image with the name:
“Page Slug”.jpg
If there is then show the image with the required html.
If it cannot find an image in the image folder with current page slug as name then do nothing, no code at all.
This is what ive found. But i will be using the standard image folder of wordpress or a root one not the template one. And i have no idea of the rest.
if( file_exists( TEMPLATEPATH . ‘/file.jpg’ ) ) {
// do whatever
}
Also this is for pages not posts, i have no idea if thats an issue, i mean, no idea if post slug is only for posts.
- The topic ‘Help with a php if file exist and page slug’ is closed to new replies.