Looking for methods to Check if File Exist

I’m working on a custom theme framework for educational purposes.

I basically have a header.php in a child theme that i want to make smarter. I’d like to only include a stylesheet if the file exist. Getting 404 errors is not cool or efficient.

Read More

Are there native php or wordpress functions to check if a wordpress file exist.

Basically…
I want to output

<link rel="stylesheet" href="<?php echo get_stylesheet_directory_uri(); ?>/css/<?php echo get_stylesheet() ?>.css" type="text/css" media="screen" />

Only If the stylesheet with the same name as the folder containing the child theme exist.

Any ideas would be awesome 🙂

Related posts

Leave a Reply

1 comment