/** * Enqueue Scripts */ function nevertheless_enqueue_scripts() { global $tamatebako; $name = $tamatebako->name; $child = $tamatebako->child; /* == JS == */ wp_enqueue_script("fitvids"); wp_enqueue_script("{$name}-script"); /* == CSS == */ wp_enqueue_style("genericons"); wp_enqueue_style("{$name}-style"); /* main css. */ if (is_child_theme()) { wp_enqueue_style("{$child}-style"); } /* child theme css. */ if (tamatebako_is_debug()) { wp_enqueue_style("{$name}-debug"); } /* media queries debug. */ }
/** * Get active theme assets file. * This function is created for getting child theme file. * Return empty if file not exist. * Also Search for minified version of the file and load it when needed. * @since 3.0.0 * @param string $file File path to load relative to child theme directory. * @param string $ext File extension, e.g "js" or "css". * @access public * @return string */ function tamatebako_child_theme_file($file, $ext) { /* Path & URI */ $path = trailingslashit(get_stylesheet_directory()) . $file; $uri = trailingslashit(get_stylesheet_directory_uri()) . $file; /* File URI */ $file_uri = ''; /* If "regular" file exist. */ if (file_exists($path . '.' . $ext)) { $file_uri = $uri . '.' . $ext; } /* If not debug & min file exist, use it! */ if (!tamatebako_is_debug() && file_exists($path . '.min.' . $ext)) { $file_uri = $uri . '.min.' . $ext; } return $file_uri; }