1
0
mirror of https://github.com/ascribe/wp-theme synced 2025-01-08 20:55:53 +01:00
wp-theme/includes/functions/core.php
2015-09-16 17:50:43 -06:00

95 lines
1.9 KiB
PHP

<?php
/**
* Set up theme defaults and register supported WordPress features.
*
* @since 0.1.0
*
* @uses add_action()
*
* @return void.
*/
function setup() {
$n = function( $function ) {
return __NAMESPACE__ . "\\$function";
};
add_action( 'after_setup_theme', $n( 'i18n' ) );
add_action( 'wp_head', $n( 'header_meta' ) );
add_action( 'wp_enqueue_scripts', $n( 'scripts' ) );
add_action( 'wp_enqueue_scripts', $n( 'styles' ) );
}
/**
* Makes WP Theme available for translation.
*
* Translations can be added to the /lang directory.
* If you're building a theme based on WP Theme, use a find and replace
* to change 'wptheme' to the name of your theme in all template files.
*
* @uses load_theme_textdomain() For translation/localization support.
*
* @since 0.1.0
*
* @return void.
*/
function i18n() {
load_theme_textdomain( 'ttl', TTL_PATH . '/languages' );
}
/**
* Enqueue scripts for front-end.
*
* @uses wp_enqueue_script() to load front end scripts.
*
* @since 0.1.0
*
* @return void.
*/
function scripts( $debug = false ) {
$min = ( $debug || defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
wp_enqueue_script(
'ttl',
TTL_TEMPLATE_URL . "/assets/js/ascribeio{$min}.js",
array(),
TTL_VERSION,
true
);
}
/**
* Enqueue styles for front-end.
*
* @uses wp_enqueue_style() to load front end styles.
*
* @since 0.1.0
*
* @return void.
*/
function styles( $debug = false ) {
$min = ( $debug || defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
wp_enqueue_style(
'ttl',
TTL_URL . "/assets/css/ascribeio{$min}.css",
array(),
TTL_VERSION
);
}
/**
* Add humans.txt to the <head> element.
*
* @uses apply_filters()
*
* @since 0.1.0
*
* @return void.
*/
function header_meta() {
$humans = '<link type="text/plain" rel="author" href="' . TTL_TEMPLATE_URL . '/humans.txt" />';
echo apply_filters( 'ttl_humans', $humans );
}