* 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' ); * ... * } * * * For more information on hooks, actions, and filters, see http://codex.wordpress.org/Plugin_API. * * @package Catch Themes * @subpackage Catch_Box * @since Catch Box 1.0 */ /** * 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() { /** * Global content width. * * Set the content width based on the theme's design and stylesheet. * making it large as we have template without sidebar which is large */ if ( ! isset( $content_width ) ) $content_width = 818; /* 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' ); /** * Add callback for custom TinyMCE editor stylesheets. (editor-style.css) * @see http://codex.wordpress.org/Function_Reference/add_editor_style */ add_editor_style(); // Load up our theme options page and related code. require( get_template_directory() . '/inc/theme-options.php' ); // Grab Catch Box's Adspace Widget. require( get_template_directory() . '/inc/widgets.php' ); // Add default posts and comments RSS feed links to
. add_theme_support( 'automatic-feed-links' ); /** * Setup title support for theme * Supported from WordPress version 4.1 onwards * More Info: https://make.wordpress.org/core/2014/10/29/title-tags-in-4-1/ */ add_theme_support( 'title-tag' ); /** * 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 add_theme_support( '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' ); // The next four constants set how Catch Boxsupports custom headers. // The default header text color define( 'HEADER_TEXTCOLOR', '000' ); // By leaving empty, we allow for random image rotation. define( 'HEADER_IMAGE', '' ); // The height and width of your custom header used for site logo. // Add a filter to catchbox_header_image_width and catchbox_header_image_height to change these values. define( 'HEADER_IMAGE_WIDTH', apply_filters( 'catchbox_header_image_width', 300 ) ); define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'catchbox_header_image_height', 125 ) ); // We'll be using post thumbnails for custom header images for logos. // We want them to be the size of the header image that we just defined // Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php. set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true ); // Add Catch Box's custom image sizes add_image_size( 'featured-header', HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true ); // Used for logo (header) images //disable old image size for featued posts add_image_size( 'featured-slider', 560, 270, true ); add_image_size( 'featured-slider', 644, 320, true ); // Used for featured posts if a large-feature doesn't exist // Add support for custom header add_theme_support( 'custom-header', array( // Header image random rotation default 'random-default' => false, // Header image flex width 'flex-width' => true, // Header image flex height 'flex-height' => true, // Template header style callback 'wp-head-callback' => 'catchbox_header_style', // Admin header style callback 'admin-head-callback' => 'catchbox_admin_header_style', // Admin preview style callback 'admin-preview-callback' => 'catchbox_admin_header_image' ) ); // Default custom headers packaged with the theme. %s is a placeholder for the theme template directory URI. register_default_headers( array( 'wheel' => array( 'url' => '%s/images/headers/garden.jpg', 'thumbnail_url' => '%s/images/headers/garden-thumbnail.jpg', /* translators: header image description */ 'description' => __( 'Garden', 'catchbox' ) ), 'shore' => array( 'url' => '%s/images/headers/flower.jpg', 'thumbnail_url' => '%s/images/headers/flower-thumbnail.jpg', /* translators: header image description */ 'description' => __( 'Flower', 'catchbox' ) ), 'trolley' => array( 'url' => '%s/images/headers/mountain.jpg', 'thumbnail_url' => '%s/images/headers/mountain-thumbnail.jpg', /* translators: header image description */ 'description' => __( 'Mountain', 'catchbox' ) ), ) ); } endif; // catchbox_setup if ( ! function_exists( 'catchbox_header_style' ) ) : /** * Styles the header image and text displayed on the blog * * @since Catch Box 1.0 */ function catchbox_header_style() { $text_color = get_header_textcolor(); // If no custom options for text are set, let's bail. if ( $text_color == HEADER_TEXTCOLOR ) return; // If we get this far, we have custom styles. Let's do this. ?> Header admin panel. * * @since Catch Box 1.0 */ function catchbox_admin_header_style() { ?> Header admin panel. * * @since Catch Box 1.0 */ function catchbox_admin_header_image() { ?> tag based on what is being viewed. * * @param string $title Default title text for current view. * @param string $sep Optional separator. * @return string The filtered title. */ function catchbox_wp_title( $title, $sep ) { if ( is_feed() ) { return $title; } global $page, $paged; // Add the blog name $title .= get_bloginfo( 'name', 'display' ); // Add the blog description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) { $title .= " $sep $site_description"; } // Add a page number if necessary: if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) { $title .= " $sep " . sprintf( __( 'Page %s', '_s' ), max( $paged, $page ) ); } return $title; } add_filter( 'wp_title', 'catchbox_wp_title', 10, 2 ); /** * Title shim for sites older than WordPress 4.1. * * @link https://make.wordpress.org/core/2014/10/29/title-tags-in-4-1/ * @todo Remove this function when WordPress 4.3 is released. */ function catchbox_render_title() { ?>', '' ); ?>
' . ( $req ? '*' : '' ) . '
'; return $fields; } endif; // catchbox_comment_form_fields add_filter( 'comment_form_default_fields', 'catchbox_comment_form_fields' ); /** * Get the favicon Image from theme options * * @uses favicon * @get the data value of image from theme options * @display favicon * * @uses set_transient and delete_transient */ function catchbox_favicon() { //delete_transient( 'catchbox_favicon' ); if ( !$catchbox_favicon = get_transient( 'catchbox_favicon' ) ) { $options = catchbox_get_theme_options(); if ( !empty( $options['fav_icon'] ) ) { $catchbox_favicon = ''; } set_transient( 'catchbox_favicon', $catchbox_favicon, 86940 ); } echo $catchbox_favicon ; } //Load Favicon in Header Section add_action('wp_head', 'catchbox_favicon'); //Load Favicon in Admin Section add_action( 'admin_head', 'catchbox_favicon' ); /** * Get the Web Click Icon from theme options * * @uses web clip * @get the data value of image from theme options * @display web clip * * @uses set_transient and delete_transient */ function catchbox_webclip() { //delete_transient( 'catchbox_webclip' ); if ( !$catchbox_webclip = get_transient( 'catchbox_webclip' ) ) { $options = catchbox_get_theme_options(); if ( !empty( $options['web_clip'] ) ) { $catchbox_webclip = ''; } set_transient( 'catchbox_webclip', $catchbox_webclip, 86940 ); } echo $catchbox_webclip ; } //Load webclip in Header Section add_action('wp_head', 'catchbox_webclip'); /** * Redirect WordPress Feeds To FeedBurner */ function catchbox_rss_redirect() { $options = catchbox_get_theme_options(); if ( !empty( $options['feed_url'] ) ) { $url = 'Location: '.$options['feed_url']; if ( is_feed() && !preg_match('/feedburner|feedvalidator/i', $_SERVER['HTTP_USER_AGENT'])) { header($url); header('HTTP/1.1 302 Temporary Redirect'); } } } add_action('template_redirect', 'catchbox_rss_redirect'); if ( ! function_exists( 'catchbox_socialprofile' ) ): /** * Social Profles * * @since Catch Box 1.0 */ function catchbox_socialprofile() { //delete_transient( 'catchbox_socialprofile' ); $options = get_option('catchbox_options_social_links'); $flag = 0; if( !empty( $options ) ) { foreach( $options as $option ) { if( $option ) { $flag = 1; } else { $flag = 0; } if( $flag == 1) { break; } } } if( ( !$catchbox_socialprofile = get_transient( 'catchbox_socialprofile' ) ) && ($flag == 1) ) { echo ''; $catchbox_socialprofile = ' '; set_transient( 'catchbox_socialprofile', $catchbox_socialprofile, 604800 ); } echo $catchbox_socialprofile; } endif; // catchbox_socialprofile // Load Social Profile catchbox_site_generator hook add_action('catchbox_site_generator', 'catchbox_socialprofile', 10 ); if ( ! function_exists( 'catchbox_slider_display' ) ) : /** * Display slider */ function catchbox_slider_display() { global $post, $wp_query; // Front page displays in Reading Settings $page_on_front = get_option('page_on_front') ; $page_for_posts = get_option('page_for_posts'); // Get Page ID outside Loop $page_id = $wp_query->get_queried_object_id(); if ( is_front_page() || ( is_home() && $page_for_posts != $page_id ) ) { if ( function_exists( 'catchbox_pass_slider_value' ) ) { catchbox_pass_slider_value(); } if ( function_exists( 'catchbox_sliders' ) ) { catchbox_sliders(); } } } endif; //catchbox_slider_display // Load slider in catchbox_content hook add_action('catchbox_content', 'catchbox_slider_display', 10); if ( ! function_exists( 'catchbox_header_image' ) ) : /** * Template for Header Image * * To override this in a child theme * simply create your own catchbox_header_image(), and that function will be used instead. * * @since Catch Box 2.5 */ function catchbox_header_image() { // Check to see if the header image has been removed global $_wp_default_headers; $header_image = get_header_image(); if ( ! empty( $header_image ) ) : ?> '; else : echo ' '; if ( $sitedetails == '0' ) { echo catchbox_header_image(); echo catchbox_header_details(); } else { echo catchbox_header_details(); echo catchbox_header_image(); } echo '