Read More

'; } /** * Sets up theme defaults and registers the various WordPress features that * AppGate supports. * * @uses load_theme_textdomain() For translation/localization support. * @uses add_editor_style() To add Visual Editor stylesheets. * @uses add_theme_support() To add support for automatic feed links, post * formats, and post thumbnails. * @uses register_nav_menu() To add support for a navigation menu. * @uses set_post_thumbnail_size() To set a custom post thumbnail size. * * @since AppGate 0.9 * * @return void */ function appgate_setup() { /* * Makes AppGate available for translation. * * Translations can be added to the /languages/ directory. * If you're building a theme based on AppGate, use a find and * replace to change 'appgate' to the name of your theme in all * template files. */ load_theme_textdomain( 'appgate', get_template_directory() . '/languages' ); /* * This theme styles the visual editor to resemble the theme style, * specifically font, colors, icons, and column width. */ add_editor_style( array( 'css/editor-style.css', 'fonts/genericons.css', appgate_fonts_url() ) ); // Adds RSS feed links to for posts and comments. add_theme_support( 'automatic-feed-links' ); // Switches default core markup for search form, comment form, and comments // to output valid HTML5. add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list' ) ); /* * This theme supports all available post formats by default. * See http://codex.wordpress.org/Post_Formats */ add_theme_support( 'post-formats', array( 'aside', 'audio', 'chat', 'gallery', 'image', 'link', 'quote', 'status', 'video' ) ); // This theme uses wp_nav_menu() in one location. register_nav_menu( 'primary', __( 'Navigation Menu', 'appgate' ) ); /* * This theme uses a custom image size for featured images, displayed on * "standard" posts and pages. */ add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 400, 150, true ); // This theme uses its own gallery styles. add_filter( 'use_default_gallery_style', '__return_false' ); // Nav menu selected css //add_filter('nav_menu_css_class' , 'add_nav_class' , 10 , 2); /** * Add support for Title tags */ add_theme_support( 'title-tag' ); //add_image_size( 'appgate_logo', 160, 40 ); //add_theme_support( 'custom-logo', array( 'size' => 'appgate_logo' ) ); add_theme_support( 'custom-logo', array( 'height' => 40, 'width' => 160, 'flex-width' => true ) ); add_theme_support( 'custom-background' ); add_image_size( 'appgate_slide', 300, 300 ); } add_action( 'after_setup_theme', 'appgate_setup' ); /** * Returns the Google font stylesheet URL, if available. * * The use of Source Sans Pro and Bitter by default is localized. For languages * that use characters not supported by the font, the font can be disabled. * * @since AppGate 0.9 * * @return string Font stylesheet or empty string if disabled. */ function appgate_fonts_url() { $fonts_url = ''; /* Translators: If there are characters in your language that are not * supported by Source Sans Pro, translate this to 'off'. Do not translate * into your own language. */ $source_sans_pro = _x( 'on', 'Source Sans Pro font: on or off', 'appgate' ); /* Translators: If there are characters in your language that are not * supported by Bitter, translate this to 'off'. Do not translate into your * own language. */ $bitter = _x( 'on', 'Bitter font: on or off', 'appgate' ); if ( 'off' !== $source_sans_pro || 'off' !== $bitter ) { $font_families = array(); if ( 'off' !== $source_sans_pro ) $font_families[] = 'Source Sans Pro:300,400,700,300italic,400italic,700italic'; if ( 'off' !== $bitter ) $font_families[] = 'Bitter:400,700'; $query_args = array( 'family' => urlencode( implode( '|', $font_families ) ), 'subset' => urlencode( 'latin,latin-ext' ), ); $fonts_url = add_query_arg( $query_args, "//fonts.googleapis.com/css" ); } return $fonts_url; } /** * Enqueues scripts and styles for front end. * * @since AppGate 0.9 * * @return void */ function appgate_scripts_styles() { // Adds JavaScript to pages with the comment form to support sites with // threaded comments (when in use). if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' ); // Adds Masonry to handle vertical alignment of footer widgets. if ( is_active_sidebar( 'sidebar-1' ) ) wp_enqueue_script( 'jquery-masonry' ); // Loads JavaScript file with functionality specific to AppGate. wp_enqueue_script( 'appgate-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '2013-07-18', true ); // Add Open Sans and Bitter fonts, used in the main stylesheet. wp_enqueue_style( 'appgate-fonts', appgate_fonts_url(), array(), null ); // Add Genericons font, used in the main stylesheet. wp_enqueue_style( 'genericons', get_template_directory_uri() . '/fonts/genericons.css', array(), '2.09' ); // Loads our main stylesheet. wp_enqueue_style( 'appgate-style', get_stylesheet_uri(), array(), '2013-07-18' ); // Loads the Internet Explorer specific stylesheet. wp_enqueue_style( 'appgate-ie', get_template_directory_uri() . '/css/ie.css', array( 'appgate-style' ), '2013-07-18' ); wp_style_add_data( 'appgate-ie', 'conditional', 'lt IE 9' ); wp_enqueue_style( 'fontawesome', get_template_directory_uri() . '/css/font-awesome.min.css', false, '1.0' ); wp_register_script( 'easing', get_template_directory_uri() . '/js/jquery.easing.js', 'jquery' ); wp_register_script( 'slider', get_template_directory_uri() . '/js/jquery.slider.min.js', 'jquery', 'easing' ); wp_register_script( 'animatebg', get_template_directory_uri() . '/js/jquery.animatebackground.js', 'jquery' ); wp_register_script( 'appgate', get_template_directory_uri() . '/js/main.js', 'jquery', 'slider', 'animatebackground' ); wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'easing' ); wp_enqueue_script( 'slider' ); wp_enqueue_script( 'animatebg' ); wp_enqueue_script( 'appgate' ); } add_action( 'wp_enqueue_scripts', 'appgate_scripts_styles' ); /** * Creates a nicely formatted and more specific title element text for output * in head of document, based on current view. * * @since AppGate 0.9 * * @param string $title Default title text for current view. * @param string $sep Optional separator. * @return string The filtered title. */ function appgate_wp_title( $title, $sep ) { global $paged, $page; if ( is_feed() ) return $title; // Add the site name. $title .= get_bloginfo( 'name' ); // Add the site description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) $title = "$title $sep $site_description"; // Add a page number if necessary. if ( $paged >= 2 || $page >= 2 ) $title = "$title $sep " . sprintf( __( 'Page %s', 'appgate' ), max( $paged, $page ) ); return $title; } add_filter( 'wp_title', 'appgate_wp_title', 10, 2 ); /** * Registers two widget areas. * * @since AppGate 0.9 * * @return void */ function appgate_widgets_init() { register_sidebar( array( 'name' => __( 'Main Widget Area', 'appgate' ), 'id' => 'sidebar-1', 'description' => __( 'Appears in the footer section of the site.', 'appgate' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Secondary Widget Area', 'appgate' ), 'id' => 'sidebar-2', 'description' => __( 'Appears on posts and pages in the sidebar.', 'appgate' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'appgate_widgets_init' ); if ( ! function_exists( 'appgate_paging_nav' ) ) : /** * Displays navigation to next/previous set of posts when applicable. * * @since AppGate 0.9 * * @return void */ function appgate_paging_nav() { global $wp_query; // Don't print empty markup if there's only one page. if ( $wp_query->max_num_pages < 2 ) return; ?> post_parent ) : get_adjacent_post( false, '', true ); $next = get_adjacent_post( false, '', false ); if ( ! $next && ! $previous ) return; ?> ' . __( 'Sticky', 'appgate' ) . ''; if ( ! has_post_format( 'link' ) && 'post' == get_post_type() ) appgate_entry_date(); // Translators: used between list items, there is a space after the comma. $categories_list = get_the_category_list( __( ' ', 'appgate' ) ); if ( $categories_list ) { echo '' . $categories_list . ''; } // Translators: used between list items, there is a space after the comma. $tag_list = get_the_tag_list( '', __( ' ', 'appgate' ) ); if ( $tag_list ) { echo '' . $tag_list . ''; } // Post author if ( 'post' == get_post_type() ) { printf( '', esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_attr( sprintf( __( 'View all posts by %s', 'appgate' ), get_the_author() ) ), get_the_author() ); } } endif; if ( ! function_exists( 'appgate_entry_date' ) ) : /** * Prints HTML with date information for current post. * * Create your own appgate_entry_date() to override in a child theme. * * @since AppGate 0.9 * * @param boolean $echo Whether to echo the date. Default true. * @return string The HTML-formatted post date. */ function appgate_entry_date( $echo = true ) { if ( has_post_format( array( 'chat', 'status' ) ) ) $format_prefix = _x( '%1$s on %2$s', '1: post format name. 2: date', 'appgate' ); else $format_prefix = '%2$s'; $date = sprintf( '', esc_url( get_permalink() ), esc_attr( sprintf( __( 'Permalink to %s', 'appgate' ), the_title_attribute( 'echo=0' ) ) ), esc_attr( get_the_date( 'c' ) ), esc_html( sprintf( $format_prefix, get_post_format_string( get_post_format() ), get_the_date() ) ) ); if ( $echo ) echo $date; return $date; } endif; if ( ! function_exists( 'appgate_the_attached_image' ) ) : /** * Prints the attached image with a link to the next attached image. * * @since AppGate 0.9 * * @return void */ function appgate_the_attached_image() { $post = get_post(); $attachment_size = apply_filters( 'appgate_attachment_size', array( 724, 724 ) ); $next_attachment_url = wp_get_attachment_url(); /** * Grab the IDs of all the image attachments in a gallery so we can get the URL * of the next adjacent image in a gallery, or the first image (if we're * looking at the last image in a gallery), or, in a gallery of one, just the * link to that image file. */ $attachment_ids = get_posts( array( 'post_parent' => $post->post_parent, 'fields' => 'ids', 'numberposts' => -1, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID' ) ); // If there is more than 1 attachment in a gallery... if ( count( $attachment_ids ) > 1 ) { foreach ( $attachment_ids as $attachment_id ) { if ( $attachment_id == $post->ID ) { $next_id = current( $attachment_ids ); break; } } // get the URL of the next image attachment... if ( $next_id ) $next_attachment_url = get_attachment_link( $next_id ); // or get the URL of the first image attachment. else $next_attachment_url = get_attachment_link( array_shift( $attachment_ids ) ); } printf( '%3$s', esc_url( $next_attachment_url ), the_title_attribute( array( 'echo' => false ) ), wp_get_attachment_image( $post->ID, $attachment_size ) ); } endif; /** * Returns the URL from the post. * * @uses get_url_in_content() to get the URL in the post meta (if it exists) or * the first link found in the post content. * * Falls back to the post permalink if no URL is found in the post. * * @since AppGate 0.9 * * @return string The Link format URL. */ function appgate_get_link_url() { $content = get_the_content(); $has_url = get_url_in_content( $content ); return ( $has_url ) ? $has_url : apply_filters( 'the_permalink', get_permalink() ); } /** * Extends the default WordPress body classes. * * Adds body classes to denote: * 1. Single or multiple authors. * 2. Active widgets in the sidebar to change the layout and spacing. * 3. When avatars are disabled in discussion settings. * * @since AppGate 0.9 * * @param array $classes A list of existing body class values. * @return array The filtered body class list. */ function appgate_body_class( $classes ) { if ( ! is_multi_author() ) $classes[] = 'single-author'; if ( is_active_sidebar( 'sidebar-2' ) && ! is_attachment() && ! is_404() ) $classes[] = 'sidebar'; if ( ! get_option( 'show_avatars' ) ) $classes[] = 'no-avatars'; return $classes; } add_filter( 'body_class', 'appgate_body_class' ); /** * Adjusts content_width value for video post formats and attachment templates. * * @since AppGate 0.9 * * @return void */ function appgate_content_width() { global $content_width; if ( is_attachment() ) $content_width = 724; elseif ( has_post_format( 'audio' ) ) $content_width = 484; } add_action( 'template_redirect', 'appgate_content_width' ); /** * Add postMessage support for site title and description for the Customizer. * * @since AppGate 0.9 * * @param WP_Customize_Manager $wp_customize Customizer object. * @return void */ function appgate_customize_register( $wp_customize ) { $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; } add_action( 'customize_register', 'appgate_customize_register' ); /** * Binds JavaScript handlers to make Customizer preview reload changes * asynchronously. * * @since AppGate 0.9 */ function appgate_customize_preview_js() { wp_enqueue_script( 'appgate-customizer', get_template_directory_uri() . '/js/theme-customizer.js', array( 'customize-preview' ), '20130226', true ); } add_action( 'customize_preview_init', 'appgate_customize_preview_js' ); /** * Custom settings */ function appgate_custom_settings( $wp_customize ) { // Feature section $wp_customize->add_section( 'appgate_feature' , array( 'title' => __( 'App Feature', 'appgate' ), 'priority' => 54, ) ); // Feature image $wp_customize->add_setting( 'appgate_feature_image', array( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'appgate_feature_image', array( 'label' => __( 'Feature Image', 'appgate' ), 'section' => 'appgate_feature', 'settings' => 'appgate_feature_image', ) ) ); // Feature title $wp_customize->add_setting( 'appgate_feature_title' , array( 'sanitize_callback' => 'esc_attr', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'appgate_feature_title', array( 'label' => __('Feature Title', 'appgate'), 'section' => 'appgate_feature', 'settings' => 'appgate_feature_title', 'type' => 'text', ) ) ); // Feature description $wp_customize->add_setting( 'appgate_feature_description' , array( 'sanitize_callback' => 'esc_attr', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'appgate_feature_description', array( 'label' => __('Feature Description', 'appgate'), 'section' => 'appgate_feature', 'settings' => 'appgate_feature_description', 'type' => 'text', ) ) ); // Feature App Store $wp_customize->add_setting( 'appgate_feature_as' , array( 'sanitize_callback' => 'esc_attr', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'appgate_feature_as', array( 'label' => __('App Store Link', 'appgate'), 'section' => 'appgate_feature', 'settings' => 'appgate_feature_as', 'type' => 'text', ) ) ); // Feature Google Play $wp_customize->add_setting( 'appgate_feature_gp' , array( 'sanitize_callback' => 'esc_attr', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'appgate_feature_gp', array( 'label' => __('Google Play Link', 'appgate'), 'section' => 'appgate_feature', 'settings' => 'appgate_feature_gp', 'type' => 'text', ) ) ); // Feature button link $wp_customize->add_setting( 'appgate_button_link' , array( 'sanitize_callback' => 'esc_attr', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'appgate_button_link', array( 'label' => __('Button Link', 'appgate'), 'section' => 'appgate_feature', 'settings' => 'appgate_button_link', 'type' => 'text', ) ) ); // Feature button text $wp_customize->add_setting( 'appgate_button_text' , array( 'sanitize_callback' => 'esc_attr', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'appgate_button_text', array( 'label' => __('Button Text', 'appgate'), 'section' => 'appgate_feature', 'settings' => 'appgate_button_text', 'type' => 'text', ) ) ); // Footer section $wp_customize->add_section( 'appgate_footer' , array( 'title' => __( 'Footer', 'appgate' ), 'priority' => 117, ) ); // Credit link $wp_customize->add_setting( 'appgate_credit_link' , array( 'default' => 1, 'sanitize_callback' => 'esc_attr', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'appgate_credit_link', array( 'label' => __('Hide Credit', 'appgate'), 'section' => 'appgate_footer', 'settings' => 'appgate_credit_link', 'type' => 'checkbox', ) ) ); // Copyright text $wp_customize->add_setting( 'appgate_copyright_text' , array( 'default' => 'is licensed under Creative Commons', 'sanitize_callback' => 'esc_attr', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'appgate_copyright_text', array( 'label' => __('Copyright Text', 'appgate'), 'section' => 'appgate_footer', 'settings' => 'appgate_copyright_text', 'type' => 'text', ) ) ); // Footer App Store $wp_customize->add_setting( 'appgate_footer_as' , array( 'sanitize_callback' => 'esc_attr', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'appgate_footer_as', array( 'label' => __('App Store Link', 'appgate'), 'section' => 'appgate_footer', 'settings' => 'appgate_footer_as', 'type' => 'text', ) ) ); // Footer Google Play $wp_customize->add_setting( 'appgate_footer_gp' , array( 'sanitize_callback' => 'esc_attr', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'appgate_footer_gp', array( 'label' => __('Google Play Link', 'appgate'), 'section' => 'appgate_footer', 'settings' => 'appgate_footer_gp', 'type' => 'text', ) ) ); // Footer logo $wp_customize->add_setting( 'appgate_footer_logo', array( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'appgate_footer_logo', array( 'label' => __( 'Footer Logo', 'appgate' ), 'section' => 'appgate_footer', 'settings' => 'appgate_footer_logo', ) ) ); // Text colour $wp_customize->add_setting( 'appgate_text_colour' , array( 'default' => '#777777', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'appgate_text_colour', array( 'label' => __( 'Text Colour', 'appgate' ), 'section' => 'colors', 'settings' => 'appgate_text_colour', ) ) ); // Title colour $wp_customize->add_setting( 'appgate_title_colour' , array( 'default' => '#444444', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'appgate_title_colour', array( 'label' => __( 'Title Colour', 'appgate' ), 'section' => 'colors', 'settings' => 'appgate_title_colour', ) ) ); // Link colour $wp_customize->add_setting( 'appgate_link_colour' , array( 'default' => '#6699CC', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'appgate_link_colour', array( 'label' => __( 'Link Colour', 'appgate' ), 'section' => 'colors', 'settings' => 'appgate_link_colour', ) ) ); // Hover colour $wp_customize->add_setting( 'appgate_hover_colour' , array( 'default' => '#4477CC', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'appgate_hover_colour', array( 'label' => __( 'Hover Colour', 'appgate' ), 'section' => 'colors', 'settings' => 'appgate_hover_colour', ) ) ); // Button colour $wp_customize->add_setting( 'appgate_button_colour' , array( 'default' => '#FAFAFA', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'appgate_button_colour', array( 'label' => __( 'Button Colour', 'appgate' ), 'section' => 'colors', 'settings' => 'appgate_button_colour', ) ) ); // Button hover colour $wp_customize->add_setting( 'appgate_button_hover_colour' , array( 'default' => '#FFFFFF', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'appgate_button_hover_colour', array( 'label' => __( 'Button Hover Colour', 'appgate' ), 'section' => 'colors', 'settings' => 'appgate_button_hover_colour', ) ) ); // Button text colour $wp_customize->add_setting( 'appgate_button_text_colour' , array( 'default' => '#000000', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'appgate_button_text_colour', array( 'label' => __( 'Button Text Colour', 'appgate' ), 'section' => 'colors', 'settings' => 'appgate_button_text_colour', ) ) ); // Input focus colour $wp_customize->add_setting( 'appgate_input_focus_colour' , array( 'default' => '#FFFFFF', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'appgate_input_focus_colour', array( 'label' => __( 'Input Focus Colour', 'appgate' ), 'section' => 'colors', 'settings' => 'appgate_input_focus_colour', ) ) ); } add_action( 'customize_register', 'appgate_custom_settings' ); /** * Custom CSS */ function appgate_custom_css() { $text_colour = get_theme_mod( 'appgate_text_colour', '#777777' ); $title_colour = get_theme_mod( 'appgate_title_colour', '#444444' ); $link_colour = get_theme_mod( 'appgate_link_colour', '#6699CC' ); $hover_colour = get_theme_mod( 'appgate_hover_colour', '#4477CC' ); $button_colour = get_theme_mod( 'appgate_button_colour', '#FAFAFA' ); $button_hover_colour = get_theme_mod( 'appgate_button_hover_colour', '#FFFFFF' ); $button_text_colour = get_theme_mod( 'appgate_button_text_colour', '#000000' ); $input_focus_colour = get_theme_mod( 'appgate_input_focus_colour', '#FFFFFF' ); ?> ' . get_bloginfo('name') . ''; echo $output; } /** * Woocommerce */ function woocommerce_support() { add_theme_support( 'woocommerce' ); } add_action( 'after_setup_theme', 'woocommerce_support' );