<?php
	/**
		* law functions and definitions
		*
		* Set up the theme and provides some helper functions, which are used in the
		* theme as custom template tags. Others are attached to action and filter
		* hooks in WordPress to change core functionality.
		*
		* When using a child theme 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.
		*
		* @link https://codex.wordpress.org/Theme_Development
		* @link https://codex.wordpress.org/Child_Themes
		*
		* Functions that are not pluggable (not wrapped in function_exists()) are
		* instead attached to a filter or action hook.
		*
		* For more information on hooks, actions, and filters,
		* {@link https://codex.wordpress.org/Plugin_API}
		*
		* @package WordPress
		* @subpackage law
		* @since law 1.0
	*/
	
	add_theme_support('menus');	
	
	function add_search($items, $args) {
		if( $args->theme_location == 'primary' ){
			$items .= '<li class="searchButton"><a href="#"></a></li>';
		}
		return $items;
	}
	add_filter('wp_nav_menu_items','add_search', 10, 2);
	
	function starter_scripts() {
		wp_deregister_script( 'jquery' );
		wp_register_script( 'jquery', includes_url( '/js/jquery/jquery.js' ), false, NULL, true );
		wp_enqueue_script( 'jquery' );
		
		/*wp_enqueue_style( 'starter-style', get_stylesheet_uri() );*/
		wp_enqueue_script( 'includes', get_template_directory_uri() . '/js/includes.min.js', '', '', true );
	}
	add_action( 'wp_enqueue_scripts', 'starter_scripts' );
	
	function my_search_form( $form ) {
		
		$form = '
		<form role="search" class="search-form" method="get" id="searchform" action="' . home_url( '/' ) . '" >
		<input name="s" placeholder="Looking for something?" type="text">
		<input value="Search" type="submit">
		</form>';
		
		return $form;
	}	
	add_filter( 'get_search_form', 'my_search_form' );
	
	function plugin_myContentFilter($content)
	{
		// Take the existing content and return a subset of it
		return substr($content, 0, 300).'...';
	}
    add_filter("the_content", "plugin_myContentFilter");
	
	add_filter('the_content', 'do_shortcode', 11);