<?php
/**
 * Register theme support for languages, menus, post-thumbnails, post-formats etc.
 *
 * @package Biofriction
 * @since Biofriction 1.0.0
 */

if ( ! function_exists( 'foundationpress_theme_support' ) ) :
	function foundationpress_theme_support() {
		// Add language support
		load_theme_textdomain( 'foundationpress', get_template_directory() . '/languages' );

		// Switch default core markup for search form, comment form, and comments to output valid HTML5
		add_theme_support(
			'html5', array(
				'search-form',
				'comment-form',
				'comment-list',
				'gallery',
				'caption',
			)
		);

		// Add menu support
		add_theme_support( 'menus' );

		// Let WordPress manage the document title
		add_theme_support( 'title-tag' );

		// Add post thumbnail support: http://codex.wordpress.org/Post_Thumbnails
		add_theme_support( 'post-thumbnails' );

		// RSS thingy
		add_theme_support( 'automatic-feed-links' );

		// Add post formats support: https://wordpress.org/support/article/post-formats/
		add_theme_support( 'post-formats', array( 'aside', 'gallery', 'image', 'video', 'audio') );

		// Additional theme support for woocommerce 3.0.+
		// add_theme_support( 'wc-product-gallery-zoom' );
		// add_theme_support( 'wc-product-gallery-lightbox' );
		// add_theme_support( 'wc-product-gallery-slider' );

		add_theme_support( 'editor-styles' );

		add_editor_style( get_stylesheet_directory_uri() . '/dist/assets/css/editor.css' );

		// Add foundation.css as editor style https://codex.wordpress.org/Editor_Style
		// add_editor_style( 'dist/assets/css/' . foundationpress_asset_path( 'editor.css' ) );

		//
		// Add Biofriction's custom needs
		/////////////////////////////
		// Add a custom logo

		add_theme_support( 'custom-logo', array(
						'header-text' => array( 'site-title', 'site-description' ),
		) );


		// Filter the except length to 20 words.
		//
		//  @param int $length Excerpt length.
		//  @return int (Maybe) modified excerpt length.

		// function bfr_custom_excerpt_length( $length ) {
		// 		return 70;
		// }
		// add_filter( 'excerpt_length', 'bfr_custom_excerpt_length', 999 );

	}

	add_action( 'after_setup_theme', 'foundationpress_theme_support' );
endif;