/** * Functions * * This file loads the other files required by the theme. * It also sets up some basic functions for the theme. * Only edit it if you know what you're doing. * * @package Foxy * @since 1.0.0 * */ // Define Version define( 'FOXY_VERSION', '2.0.9' ); // options framework if ( !function_exists( 'optionsframework_init' ) ) { define( 'OPTIONS_FRAMEWORK_DIRECTORY', get_template_directory_uri() . '/inc/' ); require_once dirname( __FILE__ ) . '/inc/options-framework.php'; } // loads options file directly as required by theme customizer require_once dirname( __FILE__ ) . '/options.php'; // optional includes // include staff post type if ( !of_get_option( 'staff_include' ) ) { include(get_template_directory()."/includes/post-types/post-type-staff.php"); } // include food menu post type if ( !of_get_option( 'food_include' ) ) { include(get_template_directory()."/includes/post-types/post-type-food.php"); } // include services post type if ( !of_get_option( 'service_include' ) ) { include(get_template_directory()."/includes/post-types/post-type-services.php"); } // include fancybox gallery if ( !of_get_option( 'gallery' ) ) { include(get_template_directory()."/includes/lightbox.php"); } // Load Required Files if ( ! function_exists( 'foxy_load_files' ) ): function foxy_load_files() { // include function files include(get_template_directory()."/includes/fonts.php"); include(get_template_directory()."/includes/titles.php"); include(get_template_directory()."/includes/images.php"); include(get_template_directory()."/includes/queries.php"); include(get_template_directory()."/includes/scripts.php"); include(get_template_directory()."/includes/body-tag.php"); include(get_template_directory()."/includes/custom-js.php"); include(get_template_directory()."/includes/custom-css.php"); include(get_template_directory()."/includes/shortcodes.php"); include(get_template_directory()."/includes/taxonomy-images.php"); include(get_template_directory()."/includes/tha-theme-hooks.php"); include(get_template_directory()."/includes/theme-customizer.php"); include(get_template_directory()."/includes/comment-functions.php"); include(get_template_directory()."/includes/post-types/admin-style.php"); include(get_template_directory()."/includes/custom-meta-boxes/foxy.php"); // include widget files include(get_template_directory()."/includes/widgets.php"); include(get_template_directory()."/includes/widget-video.php"); include(get_template_directory()."/includes/widget-contact.php"); include(get_template_directory()."/includes/widget-facebook-like-box.php"); } endif; // foxy_load_files add_action( 'after_setup_theme', 'foxy_load_files' ); // Other Theme Functions if ( !function_exists( 'foxy_setup' ) ) { function foxy_setup() { // For localization load_theme_textdomain( 'organizedthemes', get_template_directory().'/languages' ); // RSS feeds for header add_theme_support( 'automatic-feed-links' ); // Post Formats add_theme_support( 'post-formats', array( 'image', 'gallery' ) ); add_post_type_support( 'page', 'post-formats' ); add_post_type_support( 'service', 'post-formats' ); add_post_type_support( 'staff', 'post-formats' ); add_post_type_support( 'food', 'post-formats' ); add_post_type_support( 'product', 'post-formats' ); // This theme uses wp_nav_menu() in two locations. register_nav_menus( array( 'side' => __( 'Main Navigation', 'organizedthemes' ), 'mobile' => __( 'Mobile Navigation', 'organizedthemes' ), ) ); // Declare Woocommerce Support add_theme_support( 'woocommerce' ); } // foxy_setup } add_action( 'after_setup_theme', 'foxy_setup' ); // Go to theme options after theme activated if ( is_admin() and isset($_GET['activated'] ) and $pagenow == "themes.php" ) { wp_redirect( 'themes.php?page=options-framework' ); } // Flush rewrite rules on theme activation function organizedthemes_flush_rewrite() { global $pagenow, $wp_rewrite; if ( 'themes.php' == $pagenow && isset( $_GET['activated'] ) ) $wp_rewrite->flush_rules(); } add_action( 'load-themes.php', 'organizedthemes_flush_rewrite' ); // Theme Updater // Theme Updater if ( !of_get_option( 'disable_theme_updater' ) ) { function organizedthemes_theme_update(){ /* updater args */ $updater_args = array( 'repo_uri' => 'http://support.organizedthemes.com/', 'repo_slug' => 'foxy-update', 'dashboard' => false, 'username' => false, ); /* add support for updater */ add_theme_support( 'auto-hosted-theme-updater', $updater_args ); } add_action( 'after_setup_theme', 'organizedthemes_theme_update' ); require_once( trailingslashit( get_template_directory() ) . 'includes/theme-updater.php' ); new Foxy_Theme_Updater; }