1
0
mirror of https://github.com/ascribe/wp-theme synced 2025-02-01 20:39:56 +01:00
wp-theme/includes/functions/core.php

103 lines
2.2 KiB
PHP
Raw Normal View History

2015-09-17 01:26:48 +02:00
<?php
2015-09-17 02:17:28 +02:00
namespace TenUp\ascribe\Core;
2015-09-17 01:26:48 +02:00
/**
* 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() {
2015-09-17 02:17:28 +02:00
load_theme_textdomain( 'wptheme', WPTHEME_PATH . '/languages' );
2015-09-17 01:26:48 +02:00
}
/**
* 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(
2015-09-17 02:17:28 +02:00
'wptheme',
WPTHEME_TEMPLATE_URL . "/assets/js/ascribe{$min}.js",
2015-09-17 01:26:48 +02:00
array(),
2015-09-17 02:17:28 +02:00
WPTHEME_VERSION,
2015-09-17 01:26:48 +02:00
true
);
2015-09-25 07:55:31 +02:00
wp_enqueue_script( 'ajax-pagination', WPTHEME_TEMPLATE_URL . '/assets/js/ajax-pagination.js', array( 'jquery' ), '1.0', true );
// AJAX MORE POSTS
wp_localize_script( 'ajax-pagination', 'ajaxpagination', array(
'ajaxurl' => admin_url( 'admin-ajax.php' )
));
2015-09-17 01:26:48 +02:00
}
/**
* 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(
2015-09-17 02:17:28 +02:00
'wptheme',
WPTHEME_URL . "/assets/css/ascribe{$min}.css",
2015-09-17 01:26:48 +02:00
array(),
2015-09-17 02:17:28 +02:00
WPTHEME_VERSION
2015-09-17 01:26:48 +02:00
);
}
/**
* Add humans.txt to the <head> element.
*
* @uses apply_filters()
*
* @since 0.1.0
*
* @return void.
*/
function header_meta() {
2015-09-17 02:17:28 +02:00
$humans = '<link type="text/plain" rel="author" href="' . WPTHEME_TEMPLATE_URL . '/humans.txt" />';
2015-09-17 01:26:48 +02:00
2015-09-17 02:17:28 +02:00
echo apply_filters( 'wptheme_humans', $humans );
2015-09-17 01:26:48 +02:00
}