ap_get_theme_url( string $file, mixed $plugin = false, boolean $ver = true )
Description #
Get url to a file Used for enqueue CSS or JS.
Parameters #
- $filestring (Required) File name.
- $pluginmixed (Optional) Plugin path, if calling from AnsPress extension. Default value: false
- $verboolean (Optional) When true, AnsPress version will be appended to file url. Default value: true
Source #
File: includes/functions.php
function ap_get_theme_url( $file, $plugin = false, $ver = true ) { $child_path = get_stylesheet_directory() . '/anspress/' . $file; $parent_path = get_template_directory() . '/anspress/' . $file; // Checks if the file exists in the theme first. // Otherwise serve the file from the plugin. if ( file_exists( $child_path ) ) { $template_url = get_stylesheet_directory_uri() . '/anspress/' . $file; } elseif ( file_exists( $parent_path ) ) { $template_url = get_template_directory_uri() . '/anspress/' . $file; } elseif ( false !== $plugin ) { $template_url = $plugin . 'templates/' . $file; } else { $template_url = ANSPRESS_THEME_URL . '/' . $file; } /** * Allows filtering url of a AnsPress file. * * @param string $url Url of a file. * @since 2.0 */ return apply_filters( 'ap_theme_url', $template_url . ( true === $ver ? '?v=' . AP_VERSION : '' ) ); }
Expand full source code Collapse full source code View on GitHub: includes/functions.php:98
Add your comment