1
0
mirror of https://github.com/ascribe/wp-theme synced 2024-12-22 09:13:38 +01:00
wp-theme/functions.php

110 lines
3.4 KiB
PHP
Raw Normal View History

2015-09-17 01:26:48 +02:00
<?php
/**
2015-09-17 01:50:43 +02:00
* ascribe functions and definitions
2015-09-17 01:26:48 +02:00
*
* When using a child theme (see http://codex.wordpress.org/Theme_Development and
* http://codex.wordpress.org/Child_Themes), you can override certain functions
* (those wrapped in a function_exists() call) by defining them first in your child theme's
* functions.php file. The child theme's functions.php file is included before the parent
* theme's file, so the child theme functions would be used.
*
2015-09-17 01:50:43 +02:00
* @package ascribe
2015-09-17 01:26:48 +02:00
* @since 0.1.0
*/
2015-09-18 02:13:03 +02:00
require "controller/controller.inc.php";
2015-09-17 01:26:48 +02:00
// Useful global constants
2015-09-17 02:17:28 +02:00
define( 'WPTHEME_VERSION', '0.1.0' );
define( 'WPTHEME_URL', get_stylesheet_directory_uri() );
define( 'WPTHEME_TEMPLATE_URL', get_template_directory_uri() );
define( 'WPTHEME_PATH', get_template_directory() . '/' );
define( 'WPTHEME_INC', WPTHEME_PATH . 'includes/' );
2015-09-17 01:26:48 +02:00
// Include compartmentalized functions
require_once WPTHEME_INC . 'core.php';
require_once WPTHEME_INC . 'cpt-team.php';
require_once WPTHEME_INC . 'cpt-career.php';
require_once WPTHEME_INC . 'cpt-presscoverage.php';
require_once WPTHEME_INC . 'cpt-event.php';
2016-03-07 20:24:39 +01:00
require_once WPTHEME_INC . 'cpt-testimonial.php';
2015-09-17 01:26:48 +02:00
// Run the setup functions
2015-09-18 02:13:03 +02:00
TenUp\ascribe\Core\setup();
// REMOVE WIDTH AND HEIGHT ATTRIBUTES ON THUMBNAILS
2015-11-02 11:18:22 +01:00
add_filter( 'post_thumbnail_html', 'remove_thumbnail_dimensions', 10 );
add_filter( 'image_send_to_editor', 'remove_thumbnail_dimensions', 10 );
function remove_thumbnail_dimensions( $html ) {
$html = preg_replace( '/(width|height)=\"\d*\"\s/', "", $html );
return $html;
2015-11-02 11:18:22 +01:00
}
2015-09-18 02:13:03 +02:00
2015-09-19 00:03:57 +02:00
//remove emoji script
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
2015-09-21 21:29:57 +02:00
//
////ACF Collapser temp fix
2015-10-16 05:27:03 +02:00
//add_filter('acf/compatibility/field_wrapper_class', '__return_true');
2015-09-18 02:13:03 +02:00
// TURN ON ACF SETTINGS PAGE
if( function_exists('acf_add_options_page') ) {
acf_add_options_page(array(
'page_title' => 'Theme General Settings',
'menu_title' => 'Theme Settings',
'menu_slug' => 'theme-general-settings',
'capability' => 'edit_posts',
'redirect' => false
));
2015-09-18 02:13:03 +02:00
}
//add excerpt to page
function wpcodex_add_excerpt_support_for_pages() {
add_post_type_support( 'page', 'excerpt' );
2015-09-18 02:13:03 +02:00
}
2015-09-19 00:03:57 +02:00
add_action( 'init', 'wpcodex_add_excerpt_support_for_pages' );
//Register Navigation
function register_primary_nav_menu() {
register_nav_menu('landing-menu',__( 'Product Tour Navigation Menu' ));
register_nav_menu('main-footer-menu',__( 'Main Footer Navigation Menu' ));
register_nav_menu('lower-footer-menu',__( 'Lower Footer Navigation Menu' ));
2015-09-19 00:03:57 +02:00
}
add_action( 'init', 'register_primary_nav_menu');
2015-09-25 07:55:31 +02:00
// ADD THUMBNAILS TO POSTS
add_theme_support( 'post-thumbnails' );
// ENABLE HR IN WSYWIG
function enable_more_buttons($buttons) {
$buttons[] = 'hr';
2015-09-25 07:55:31 +02:00
return $buttons;
2015-09-25 07:55:31 +02:00
}
add_filter("mce_buttons", "enable_more_buttons");
2015-10-02 01:48:59 +02:00
// THUMBNAIL ADD CUSTOM SIZE
add_action( 'after_setup_theme', 'ttl_image_setup' );
function ttl_image_setup() {
add_image_size( 'blog-crop', 600, 350, true ); //(cropped)
add_image_size( 'blog-feature-crop', 300, 175, true ); //(cropped)
2015-11-02 11:18:22 +01:00
}
// ADD QUERY VAR FOR EVENT PAGINATION
add_filter('query_vars', 'add_my_var');
function add_my_var($public_query_vars) {
$public_query_vars[] = 'date';
return $public_query_vars;
}