Àpèjúwe
This plugin provides the functions c2c_if_file_exists(), c2c_if_theme_file_exists(), c2c_if_plugin_file_exists() that check if a file exists and either return true/false or display a string containing information about the file.
- If a format string is not passed to it, the functions returns a simple boolean (true or false) indicating if the specified file exists.
- Otherwise, the format string provided to it will be used to construct a response string, which can be customized to display information about the file (such as directory, extension, name, path, size, or url). If the
$echoargument is true, that string is displayed on the page. Regardless of the value of$echo, the response string is returned by the function.
By default, c2c_if_file_exists() assumes you are looking for the file relative to the default WordPress upload directory. If you wish to search another directory, specify it as the $dir argument. c2c_if_theme_file_exists() assumes you are looking for a file relative to the currently active themeÌtumọ̀ Yorùbá: ’s home directory. c2c_if_plugin_file_exists() assumes you are looking for a file relative to the directory that contains WordPress plugins.
Links: Plugin Homepage | Plugin Directory Page | GitHub | Author Homepage
Developer Documentation
Developer documentation can be found in DEVELOPER-DOCS.md. That documentation covers the template tags and hooks provided by the plugin.
As an overview, these are the template tags provided by the plugin:
c2c_if_file_exists(): Checks if a file exists and returns true/false or displays a string containing information about the file.c2c_if_plugin_file_exists(): Checks if a file exists (relative to the plugins directory) and returns true/false or displays a string containing information about the file.c2c_if_theme_file_exists(): Checks if a file exists (relative to the current themeÌtumọ̀ Yorùbá: ’s directory) and returns true/false or displays a string containing information about the file. If the current theme is a child theme, then the function will check if the file exists first in the child themeÌtumọ̀ Yorùbá: ’s directory, and if not there, then it will check the parent themeÌtumọ̀ Yorùbá: ’s directory.
These are the hooks provided by the plugin:
c2c_if_file_exists: Filter that allows use of an alternative approach to safely invokec2c_if_file_exists()in such a way that if the plugin were deactivated or deleted, then your calls to the function wonÌtumọ̀ Yorùbá: ’t cause errors in your site.c2c_if_plugin_file_exists: Filter that allows use of an alternative approach to safely invokec2c_if_plugin_file_exists()in such a way that if the plugin were deactivated or deleted, then your calls to the function wonÌtumọ̀ Yorùbá: ’t cause errors in your site.c2c_if_theme_file_exists: Filter that allows use of an alternative approach to safely invokec2c_if_theme_file_exists()in such a way that if the plugin were deactivated or deleted, then your calls to the function wonÌtumọ̀ Yorùbá: ’t cause errors in your site.
Ìgbéwọlẹ̀
- Install via the built-in WordPress plugin installer. Or install the plugin code inside the plugins directory for your site (typically
/wp-content/plugins/). - Activate the plugin through the ‘Plugins’ admin menu in WordPress
- In one or more of your templates, utilize one of the template tags provided by this plugin (see examples)
Àwọn àgbéyẹ̀wò
Àwọn Olùkópa & Olùgbéejáde
“If File Exists” jẹ́ ètò ìṣàmúlò orísun ṣíṣí sílẹ̀. Àwọn ènìyàn wọ̀nyí ti ṣe ìkópa sí plugin yìí.
Àwọn OlùkópaA ti túmọ̀ “If File Exists” sí èdè agbègbè 1 kan. Ọpẹ́lọpẹ́ fún àwọn atúmọ̀ èdè fún àwọn ìkópa wọn.
Túmọ̀ “If File Exists” sí èdè rẹ.
Ṣe o nífẹ̀ẹ́ sí ìdàgbàsókè?
Ṣàwárí koodu, ṣàyẹ̀wò ibi ìpamọ́ SVN, tàbí ṣe àgbékalẹ̀ sí àkọsílẹ̀ ìdàgbàsókè nípasẹ̀ RSS.
Àkọsílẹ̀ àwọn àyípadà
2.4 (2025-04-18)
- New: Add ‘%file_size%’ and ‘%file_size_bytes%’ as additional substitution tags
- Change: Escape
$formatand$show_if_not_existsvalues prior to display to omit unsafe markup - Change: Discontinue unnecessary explicit loading of textdomain
- Change: Note compatibility through WP 6.8+
- Change: Note compatibility through PHP 8.3+
- Change: Update copyright date (2025)
- Unit tests:
- Change: Change test class name to match plugin name
2.3.2 (2024-08-02)
- Change: Note compatibility through WP 6.6+
- Change: Update copyright date (2024)
- New: Add
.gitignorefile - Change: Remove development and testing-related files from release packaging
- Unit tests:
- Hardening: Prevent direct web access to
bootstrap.php - Allow tests to run against current versions of WordPress
- New: Add
composer.jsonfor PHPUnit Polyfill dependency - Change: In bootstrap, store path to plugin directory in a constant
- Hardening: Prevent direct web access to
2.3.1 (2023-05-18)
- Change: Note compatibility through WP 6.3+
- Change: Update copyright date (2023)
- New: Add a potential TODO item
Full changelog is available in CHANGELOG.md.
