<?php
/**
 * This functions makes the theme compatible with qTranslate Plugin
 *
 *
 * @package Catch Themes
 * @subpackage Gridalicious
 * @since Gridalicious 3.0
 */

if ( ! function_exists( 'gridalicious_menuitem' ) ) :
/**
 * Template for Converting Home link in Custom Menu
 *
 * To override this in a child theme
 * simply create your own gridalicious_menuitem(), and that function will be used instead.
 *
 * @since Gridalicious Pro 3.0
 */
function gridalicious_menuitem( $menu_item ) {
	// convert local URLs in custom menu items	
	if ( $menu_item->type == 'custom' && stripos( $menu_item->url, get_site_url() ) !== false && function_exists( 'qtrans_convertURL' ) ) {
		$menu_item->url = qtrans_convertURL( $menu_item->url );
	}     
	return $menu_item;
} // gridalicious_menuitem
endif;

add_filter( 'wp_setup_nav_menu_item' , 'gridalicious_menuitem', 0 );


if ( ! function_exists( 'gridalicious_qtranslate_invalidcache' ) ) :
/**
 * Template for Clearing qtranslate Invalid Cache
 *
 * To override this in a child theme
 * simply create your own gridalicious_qtranslate_invalidcache(), and that function will be used instead.
 *
 * @since Gridalicious Pro 3.0
 */
function gridalicious_qtranslate_invalidcache() {
	delete_transient( 'gridalicious_featured_content' );
	delete_transient( 'gridalicious_featured_slider' );
	delete_transient( 'gridalicious_footer_content' );	
	delete_transient( 'gridalicious_featured_image' );
	delete_transient( 'all_the_cool_cats' );	
} // gridalicious_qtranslate_invalidcache
endif;

add_action( 'after_setup_theme', 'gridalicious_qtranslate_invalidcache' );