Created
May 14, 2014 19:53
-
-
Save anonymous/c6566fc37c412122f60f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Catch Box functions and definitions | |
* | |
* Sets up the theme and provides some helper functions. Some helper functions | |
* are used in the theme as custom template tags. Others are attached to action and | |
* filter hooks in WordPress to change core functionality. | |
* | |
* The first function, catchbox_setup(), sets up the theme by registering support | |
* for various features in WordPress, such as post thumbnails, navigation menus, and the like. | |
* | |
* When using a child theme (see http://codex.wordpress.org/Theme_Development and | |
* http://codex.wordpress.org/Child_Themes), 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. | |
* | |
* Functions that are not pluggable (not wrapped in function_exists()) are instead attached | |
* to a filter or action hook. The hook can be removed by using remove_action() or | |
* remove_filter() and you can attach your own function to the hook. | |
* | |
* We can remove the parent theme's hook only after it is attached, which means we need to | |
* wait until setting up the child theme: | |
* | |
* <code> | |
* add_action( 'after_setup_theme', 'my_child_theme_setup' ); | |
* function my_child_theme_setup() { | |
* // We are providing our own filter for excerpt_length (or using the unfiltered value) | |
* remove_filter( 'excerpt_length', 'catchbox_excerpt_length' ); | |
* ... | |
* } | |
* </code> | |
* | |
* For more information on hooks, actions, and filters, see http://codex.wordpress.org/Plugin_API. | |
* | |
* @package Catch Themes | |
* @subpackage Catch_Box_Pro | |
* @since Catch Box Pro 1.0 | |
*/ | |
/** | |
* Sets up the content width value based on the theme's design and stylesheet. | |
*/ | |
if ( ! isset( $content_width ) ) | |
$content_width = 644; | |
/** | |
* Tell WordPress to run catchbox_setup() when the 'after_setup_theme' hook is run. | |
*/ | |
add_action( 'after_setup_theme', 'catchbox_setup' ); | |
if ( ! function_exists( 'catchbox_setup' ) ): | |
/** | |
* Sets up theme defaults and registers support for various WordPress features. | |
* | |
* Note that this function is hooked into the after_setup_theme hook, which runs | |
* before the init hook. The init hook is too late for some features, such as indicating | |
* support post thumbnails. | |
* | |
* To override catchbox_setup() in a child theme, add your own catchbox_setup to your child theme's | |
* functions.php file. | |
* | |
* @uses load_theme_textdomain() For translation/localization support. | |
* @uses add_editor_style() To style the visual editor. | |
* @uses add_theme_support() To add support for post thumbnails, automatic feed links,custom headers and backgrounds. | |
* @uses register_nav_menus() To add support for navigation menus. | |
* @uses register_default_headers() To register the default custom header images provided with the theme. | |
* @uses set_post_thumbnail_size() To set a custom post thumbnail size. | |
* | |
* @since Catch Box 1.0 | |
*/ | |
function catchbox_setup() { | |
/* Catch Box is now available for translation. | |
* Add your files into /languages/ directory. | |
* @see http://codex.wordpress.org/Function_Reference/load_theme_textdomain | |
*/ | |
load_theme_textdomain( 'catchbox', get_template_directory() . '/languages' ); | |
$locale = get_locale(); | |
$locale_file = get_template_directory().'/languages/$locale.php'; | |
if (is_readable( $locale_file)) | |
require_once( $locale_file); | |
/** | |
* Add callback for custom TinyMCE editor stylesheets. (editor-style.css) | |
* @see http://codex.wordpress.org/Function_Reference/add_editor_style | |
*/ | |
add_editor_style(); | |
// Add default posts and comments RSS feed links to <head>. | |
add_theme_support( 'automatic-feed-links' ); | |
// Add support for a variety of post formats | |
add_theme_support( 'post-formats', array( 'aside', 'link', 'gallery', 'status', 'quote', 'image', 'chat' ) ); | |
// Load up theme options defaults | |
require( get_template_directory() . '/inc/panel/catchbox-themeoptions-defaults.php' ); | |
// Load up our theme options page and related code. | |
require( get_template_directory() . '/inc/panel/theme-options.php' ); | |
// Register Sidebar and Widget. | |
require( get_template_directory() . '/inc/catchbox-widgets.php' ); | |
// Load up our Catch Box Pro's Functions | |
require( get_template_directory() . '/inc/catchbox-functions.php' ); | |
// Load up our Simple Catch Pro's metabox | |
require( get_template_directory() . '/inc/catchbox-metabox.php' ); | |
// Load up our new theme update notifier | |
require( get_template_directory() . '/update_notifier.php' ); | |
/** | |
* This feature enables custom-menus support for a theme. | |
* @see http://codex.wordpress.org/Function_Reference/register_nav_menus | |
*/ | |
register_nav_menus(array( | |
'primary' => __( 'Primary Menu', 'catchbox' ), | |
'secondary' => __( 'Secondary Menu', 'catchbox' ), | |
'footer' => __( 'Footer Menu', 'catchbox' ) | |
) ); | |
/** | |
* This feature enables Jetpack plugin Infinite Scroll | |
*/ | |
add_theme_support( 'infinite-scroll', array( | |
'type' => 'click', | |
'container' => 'content', | |
'footer_widgets' => array( 'sidebar-2', 'sidebar-3', 'sidebar-4' ), | |
'footer' => 'page', | |
) ); | |
// Add support for custom backgrounds | |
// WordPress 3.4+ | |
if ( function_exists( 'get_custom_header') ) { | |
add_theme_support( 'custom-background' ); | |
} else { | |
// Backward Compatibility for WordPress Version 3.3 | |
add_custom_background(); | |
} | |
/** | |
* This feature enables post-thumbnail support for a theme. | |
* @see http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails | |
*/ | |
add_theme_support( 'post-thumbnails' ); | |
//featued posts | |
add_image_size( 'featured-slider-larger', 980, 400, true ); | |
add_image_size( 'featured-slider', 644, 320, true ); // Used for featured posts if a large-feature doesn't exist | |
if ( function_exists('catchbox_woocommerce' ) ) { | |
catchbox_woocommerce(); | |
} | |
//Redirect to Theme Options Page on Activation | |
global $pagenow; | |
if ( is_admin() && isset($_GET['activated'] ) && $pagenow =="themes.php" ) { | |
wp_redirect( 'themes.php?page=theme_options' ); | |
} | |
} | |
endif; // catchbox_setup | |
/** | |
* Adds support for a custom header image. | |
*/ | |
require( get_template_directory() . '/inc/custom-header.php' ); | |
/** | |
* Adds support for WooCommerce Plugin | |
*/ | |
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { | |
/** | |
* Add Suport for WooCommerce Plugin | |
*/ | |
add_theme_support( 'woocommerce' ); | |
require( get_template_directory() . '/inc/catchbox-woocommerce.php' ); | |
} | |
<?php | |
function catchbox_extra_gallery() { | |
echo do_shortcode('[go_portfolio id="flex9"]'); | |
} | |
add_action( 'catchbox_before_primary', 'catchbox_extra_gallery', 15 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment