add_action( 'wp_head', 'auto_commerce_meta_desc' ); //removes meta description from
remove_action('wp_head', 'description'); /* Custom Functions */ //Adds item to front of array, removes duplicates function auto_commerce_unshift( $array, $first) { //checks to make sure that the new string is valid if( strlen($first) > 0 ) { //adds priority kw to beginning array_unshift($array, $first); //makes sure that titles are unique return array_values(array_unique($array)); } } //Defines and sets the title tags based for the add_filter call function auto_commerce_set_title ( $title ) { //checks to see if wooCommerce is installed if ( function_exists( 'is_product' ) && function_exists ('get_terms') ) { if( is_product() ){ //Gets product categories $titles = array(); $args = array( 'number' => $number, 'orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'include' => $ids, 'parent' => 0 ); $product_categories = get_terms( 'product_cat', $args ); foreach( $product_categories as $cat ) { $titles[] = $cat->name; } //Gets product name $firstkw = get_the_title(); } else { return $title; } } else { return $title; } shuffle($titles); //sets first keyword combo if(strlen($firstkw) > 0 ) { $first = $firstkw; } else { $first = ""; } //adds first keyword combo to front of array, removes duplicates $titles = auto_commerce_unshift( $titles, $first); if(count($titles) > 0 ){ //Returns the first three keywords separated by | return join( " | ", array_slice($titles,0,min(3, count($titles) ) ) ); } else { return $title; } } //generates the meta description from the_exerpt function auto_commerce_meta_desc() { if ( function_exists( 'is_product' ) ) { if( is_product() ){ //adds meta description to echo ""; } } } //Adds Donate link in plugin menu function auto_commerce_add_plugin_action_links( $links ) { return array_merge( array( 'settings' => 'Donate'),$links); }