Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*--------------------------*
- /* Theme Setup
- /*--------------------------*/
- $themename = "QResponsive";
- $shortname = "qr";
- if (function_exists('add_theme_support')) {
- add_theme_support('post-thumbnails');
- add_theme_support('automatic-feed-links');
- }
- if(!function_exists("get_custom_body_classes")) {
- function get_custom_body_classes() {
- $classes = array();
- }}
- if ( ! isset( $content_width ) ) $content_width = 980;
- /*----------------------------------------*/
- /* Add Editor Stylesheet Support */
- /*----------------------------------------*/
- if ( function_exists('add_editor_style') ) {
- add_editor_style();
- }
- /*--------------------------*
- /* A Few Directories
- /*--------------------------*/
- define('QRESPONSIVE_URL', TEMPLATEPATH . '/');
- define('QRESPONSIVE_ADMIN', QRESPONSIVE_URL . '/admin');
- define('QRESPONSIVE_INCLUDES', QRESPONSIVE_URL . '/includes');
- /*--------------------------*
- /* Image Sizes
- /*--------------------------*/
- add_image_size('Home BPic', 127, 116, true);
- add_image_size('Gallery Pic', 352, 245, true);
- add_image_size('Gallery1 Pic', 549, 308, true);
- add_image_size('Thumbnail Pic', 51, 46, true);
- add_image_size('Blog Pic', 837, 400, true);
- add_image_size('Logo Pic', '', 80, true);
- if ( ! isset( $content_width ) ) $content_width = 980;
- /*--------------------------*
- /* Register Sidebars
- /*--------------------------*/
- if ( function_exists('register_sidebar') )
- register_sidebar(array(
- 'name' => 'Footer',
- 'before_widget' => '<div class="threecol">',
- 'after_widget' => '</div>',
- 'before_title' => '<h2>',
- 'after_title' => '</h2>',
- ));
- register_sidebar(array(
- 'name' => 'Sidebar',
- 'before_widget' => '<div class="widget-box sidebar-nav">',
- 'after_widget' => '</div>',
- 'before_title' => '<div class="title"><h2>',
- 'after_title' => '</h2></div>',
- 'link_before' => '<span>',
- 'link_after' => '<span>',
- ));
- /*--------------------------*
- /* Register Scripts
- /*--------------------------*/
- if(!function_exists("qr_scripts")) {
- function qr_scripts() {
- if( is_admin() )
- return;
- $script_directory = get_template_directory_uri();
- wp_register_script( 'tweet', $script_directory. '/js/jquery.tweet.js', array( 'jquery') );
- wp_register_script( 'isotope', $script_directory. '/js/jquery.isotope.min.js', array( 'jquery' ) );
- wp_register_script( 'main', $script_directory. '/js/jquery.main.js', 'jquery' );
- wp_enqueue_script( 'jquery' );
- wp_enqueue_script('tweet');
- wp_enqueue_script('isotope');
- wp_enqueue_script('main');
- }
- }
- add_action('init', 'qr_scripts');
- /*--------------------------*
- /* Register Menus
- /*--------------------------*/
- add_action( 'init', 'register_qr_menus' );
- function register_qr_menus() {
- register_nav_menus(
- array(
- 'menu-main' => __( 'Main Menu', 'qr' ),
- 'footer-menu' => __( 'Footer Menu', 'qr' ),
- )
- );
- }
- // remove menu container div
- function qr_wp_nav_menu_args( $args = '' )
- {
- $args['container'] = false;
- return $args;
- }
- add_filter( 'wp_nav_menu_args', 'qr_wp_nav_menu_args' );
- /*--------------------------*
- /* Extend Menu Walker
- /*--------------------------*/
- class Qr_Walker_Nav_Menu extends Walker {
- var $tree_type = array( 'post_type', 'taxonomy', 'custom' );
- var $db_fields = array( 'parent' => 'menu_item_parent', 'id' => 'db_id' );
- function start_lvl(&$output, $depth) {
- $indent = str_repeat("\t", $depth);
- $output .= "\n$indent<div class=\"drop-holder\"><div class=\"drop\"><div class=\"holder\"><ul>\n";
- }
- function end_lvl(&$output, $depth) {
- $indent = str_repeat("\t", $depth);
- $output .= "$indent</ul></div></div></div>\n";
- }
- function start_el(&$output, $item, $depth, $args) {
- global $wp_query;
- $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
- $class_names = $value = '';
- $classes = empty( $item->classes ) ? array() : (array) $item->classes;
- $classes = in_array( 'current-menu-item', $classes ) ? array( 'current-menu-item' ) : array();
- $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );
- $class_names = strlen( trim( $class_names ) ) > 0 ? ' class="' . esc_attr( $class_names ) . '"' : '';
- $id = apply_filters( 'nav_menu_item_id', '', $item, $args );
- $id = strlen( $id ) ? ' id="' . esc_attr( $id ) . '"' : '';
- if( $depth == 0 )
- $output .= $indent . '<li' . $id . $value . $class_names .'><div>';
- else
- $output .= $indent . '<li' . $id . $value . $class_names .'>';
- $attributes = ! empty( $item->attr_title ) ? ' title="' . esc_attr( $item->attr_title ) .'"' : '';
- $attributes .= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : '';
- $attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : '';
- $attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : '';
- $item_output = $args->before;
- $item_output .= '<a'. $attributes .'><span></span>';
- $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
- $item_output .= '</a>';
- $item_output .= $args->after;
- $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
- }
- function end_el(&$output, $item, $depth) {
- if( $depth == 0 )
- $output .= "</div></li>\n";
- else
- $output .= "</li>\n";
- }
- }
- /*--------------------------*
- /* Extend Mobile Menu Walker
- /*--------------------------*/
- class Qr_Mobile_Walker_Nav_Menu extends Walker {
- var $tree_type = array( 'post_type', 'taxonomy', 'custom' );
- var $db_fields = array( 'parent' => 'menu_item_parent', 'id' => 'db_id' );
- function start_lvl(&$output, $depth) {
- $indent = str_repeat("\t", $depth);
- $output .= "\n$indent<div class=\"drop-holder\"><div class=\"drop\"><div class=\"holder \"><ul>\n";
- }
- function end_lvl(&$output, $depth) {
- $indent = str_repeat("\t", $depth);
- $output .= "$indent</ul></div></div></div>\n";
- }
- function start_el(&$output, $item, $depth, $args) {
- global $wp_query;
- $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
- $class_names = $value = '';
- $classes = empty( $item->classes ) ? array() : (array) $item->classes;
- $classes = in_array( 'current-menu-item', $classes ) ? array( 'current-menu-item' ) : array();
- $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );
- $class_names = strlen( trim( $class_names ) ) > 0 ? ' class="' . esc_attr( $class_names ) . '"' : '';
- $id = apply_filters( 'nav_menu_item_id', '', $item, $args );
- $id = strlen( $id ) ? ' id="' . esc_attr( $id ) . '"' : '';
- $output .= $indent . '<li' . $id . $value . $class_names .'>';
- $attributes = ! empty( $item->attr_title ) ? ' title="' . esc_attr( $item->attr_title ) .'"' : '';
- $attributes .= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : '';
- $attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : '';
- $attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : '';
- $item_output = $args->before;
- $item_output .= '<a'. $attributes .'><em><span></span>';
- $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
- $item_output .= '</em></a>';
- $item_output .= $args->after;
- $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
- }
- function end_el(&$output, $item, $depth) {
- $output .= "</li>\n";
- }
- }
- require_once(QRESPONSIVE_INCLUDES . '/breadcrumbs/breadcrumbs.php');
- /*--------------------------*
- /* Register Post Types
- /*--------------------------*/
- register_post_type('slider', array(
- 'label' => __('Slider', 'slider'),
- 'name' => __('Slider', 'slider'),
- 'singular_label' => __('Slider', 'slider'),
- 'public' => true,
- 'show_ui' => true,
- 'capability_type' => 'post',
- 'hierarchical' => false,
- 'rewrite' => array('slug' => 'slider'),
- 'query_var' => false,
- 'menu_icon' => get_template_directory_uri(). '/images/functions/slide-ico.png',
- 'supports' => array('title', 'editor', 'author','thumbnail')
- ));
- register_post_type('gallery', array(
- 'label' => __('Gallery', 'gallery'),
- 'name' => __('Gallery', 'gallery'),
- 'singular_label' => __('Gallery', 'gallery'),
- 'public' => true,
- 'has_archive' => false,
- 'show_ui' => true,
- 'capability_type' => 'post',
- 'hierarchical' => true,
- 'rewrite' => array('slug' => 'gallery', 'with_front' => false),
- 'query_var' => false,
- 'menu_icon' => get_template_directory_uri(). '/images/functions/port-ico.png',
- 'supports' => array('title','editor','author','thumbnail','custom-fields', 'excerpt','page-attributes'),
- 'taxonomies' => array('category', 'post_tag' ),
- ));
- register_post_type('testimonial', array(
- 'label' => __('Testimonials', 'testimonial'),
- 'name' => __('Testimonials', 'testimonial'),
- 'singular_label' => __('Testimonial', 'testimonial'),
- 'add_new' => __('Add New', 'testimonial'),
- 'add_new_item' => __('Add New Testimonial', 'testimonial'),
- 'edit_item' => __('Edit Testimonial', 'testimonial'),
- 'new_item' => __('New Testimonial', 'testimonial'),
- 'public' => true,
- 'has_archive' => false,
- 'capability_type' => 'post',
- 'menu_icon' => get_template_directory_uri(). '/images/functions/testimonials-ico.png',
- 'supports' => array('title', 'editor'),
- ));
- register_post_type('team', array(
- 'label' => __('Team', 'team'),
- 'name' => __('Team', 'team'),
- 'singular_label' => __('Team', 'team'),
- 'add_new' => __('Add New', 'team'),
- 'add_new_item' => __('Add New Team Member', 'team'),
- 'edit_item' => __('Edit Team', 'team'),
- 'new_item' => __('New Team', 'team'),
- 'public' => true,
- 'has_archive' => false,
- 'capability_type' => 'post',
- 'menu_icon' => get_template_directory_uri(). '/images/functions/team-ico.png',
- 'supports' => array('title', 'editor', 'excerpt','thumbnail'),
- ));
- add_action('init', 'gallery_add_default_boxes');
- function gallery_add_default_boxes() {
- register_taxonomy_for_object_type('post_tag', 'gallery');
- register_taxonomy("gallery_categories", array("gallery"), array("hierarchical" => true, "label" => "gallery Categories", "rewrite" => true));
- }
- add_filter('pre_get_posts', 'query_post_type');
- function query_post_type($query) {
- if ( is_category() || is_tag() && empty( $query->query_vars['suppress_filters'] ) ) {
- $post_type = get_query_var('post_type');
- if($post_type)
- $post_type = $post_type;
- else
- $post_type = array('post','gallery','nav_menu_item');
- $query->set('post_type',$post_type);
- return $query;
- }
- }
- /*-----------------------------*
- /* Relabel Featured Image boxes
- /*-----------------------------*/
- function swap_featured_image_metabox($translation, $text, $domain) {
- global $post;
- $translations = get_translations_for_domain( $domain);
- if( isset($post->post_type) )
- {
- switch( $post->post_type )
- {
- case 'team':
- if ( $text == 'Featured Image')
- return $translations->translate( 'Team Member Photo' );
- break;
- case 'slider':
- if ( $text == 'Featured Image')
- return $translations->translate( 'Slide Image' );
- break;
- case 'gallery':
- if ( $text == 'Featured Image')
- return $translations->translate( 'Gallery Photo' );
- break;
- }
- }
- if ( $text == 'Set featured image')
- return $translations->translate( 'Select an image' );
- return $translation;
- }
- add_filter('gettext', 'swap_featured_image_metabox', 10, 4);
- /*--------------------------*
- /* Load Option Panel
- /*--------------------------*/
- if ( !function_exists( 'optionsframework_init' ) ) {
- define( 'OPTIONS_FRAMEWORK_DIRECTORY', get_template_directory_uri() . '/admin/' );
- require_once dirname( __FILE__ ) . '/admin/options-framework.php';
- }
- /*--------------------------*
- /* Tags/Comments
- /*--------------------------*/
- require_once(QRESPONSIVE_INCLUDES . '/tags-comments/tags.php');
- /*--------------------------*
- /* Custom Avatar
- /*--------------------------*/
- add_filter( 'avatar_defaults', 'newgravatar' );
- function newgravatar ($avatar_defaults) {
- $myavatar = get_stylesheet_directory_uri('template_directory') . '/images/img13.gif';
- $avatar_defaults[$myavatar] = "Theme Image";
- return $avatar_defaults;
- }
- /*--------------------------*
- /* Shortcodes
- /*--------------------------*/
- require_once(QRESPONSIVE_ADMIN . '/shortcodes/shortcodes/shortcodes.php');
- require_once(QRESPONSIVE_ADMIN . '/shortcodes/ptable/ptable.php');
- require_once(QRESPONSIVE_ADMIN . '/shortcodes/buttons/buttons.php');
- require_once(QRESPONSIVE_ADMIN . '/shortcodes/accordion/accordion.php');
- require_once(QRESPONSIVE_ADMIN . '/shortcodes/icons/icons.php');
- require_once(QRESPONSIVE_ADMIN . '/shortcodes/team/team.php');
- require_once(QRESPONSIVE_ADMIN . '/shortcodes/columns/columns.php');
- require_once(QRESPONSIVE_ADMIN . '/shortcodes/dropcap/dropcap.php');
- require_once(QRESPONSIVE_ADMIN . '/shortcodes/notifications/notifications.php');
- require_once(QRESPONSIVE_ADMIN . '/shortcodes/tabs/tabs.php');
- require_once(QRESPONSIVE_ADMIN . '/shortcodes/code/code.php');
- require_once(QRESPONSIVE_ADMIN . '/shortcodes/carousel/carousel.php');
- require_once(QRESPONSIVE_ADMIN . '/shortcodes/divider/divider.php');
- add_filter('widget_text', 'do_shortcode');
- /*--------------------------*
- /* Metaboxes
- /*--------------------------*/
- require_once(QRESPONSIVE_ADMIN . '/metabox/meta.php');
- /*--------------------------*
- /* Metaboxes
- /*--------------------------*/
- require_once(QRESPONSIVE_ADMIN . '/sidebars/sbars.php');
- /*--------------------------*
- /* Image Size Filter
- /*--------------------------*/
- add_filter( 'post_thumbnail_html', 'remove_width_attribute', 10 );
- add_filter( 'image_send_to_editor', 'remove_width_attribute', 10 );
- function remove_width_attribute( $html ) {
- $html = preg_replace( '/(width|height)=\"\d*\"\s/', "", $html );
- return $html;
- }
- /*--------------------------*
- /* Custom Widgets
- /*--------------------------*/
- require_once(QRESPONSIVE_INCLUDES . '/widgets/widgets.php');
- /*--------------------------*
- /* Custom Excerpt Length
- /*--------------------------*/
- function excerpt($limit) {
- $excerpt = explode(' ', get_the_excerpt(), $limit);
- if (count($excerpt)>=$limit) {
- array_pop($excerpt);
- $excerpt = implode(" ",$excerpt).'...';
- } else {
- $excerpt = implode(" ",$excerpt);
- }
- $excerpt = preg_replace('`\[[^\]]*\]`','',$excerpt);
- return $excerpt;
- }
- function content($limit) {
- $content = explode(' ', get_the_content(), $limit);
- if (count($content)>=$limit) {
- array_pop($content);
- $content = implode(" ",$content).'...';
- } else {
- $content = implode(" ",$content);
- }
- $content = preg_replace('/\[.+\]/','', $content);
- $content = apply_filters('the_content', $content);
- $content = str_replace(']]>', ']]>', $content);
- return $content;
- }
- /*---------------------------------*
- /* Inject Google Fonts & some options
- /*---------------------------------*/
- add_action('wp_head', 'qr_head');
- function qr_head() {?>
- <link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=<?php echo of_get_option('font_select', ''); ?>">
- <?php
- if( is_page_template('page-gallery1.php') || is_page_template('page-gallery2.php') || is_page_template('page-gallery3.php')) {
- ?>
- <script type="text/javascript">
- jQuery(function($) {
- $('a[rel^="#olay"]').overlay({ mask: '#999999' });
- });
- </script>
- <?php
- }
- ?>
- <?php if( of_get_option('qr_favicon','true')): { ?>
- <link rel="shortcut icon" href="<?php echo of_get_option('qr_favicon',''); ?>" />
- <?php } endif;?>
- <?php
- $icon = of_get_option('box1_img', '');
- $icon2 = of_get_option('box2_img', '');
- $icon3 = of_get_option('box3_img', '');
- $icon4 = of_get_option('box4_img', '');
- $font = of_get_option('font_select', '');
- $font_size = of_get_option('font_size', '');
- $site_logo = of_get_option('qr_logo','');
- $site_logom = of_get_option('qr_logom','');
- ?>
- <style type="text/css">
- body { font:<?php echo $font_size;
- ?>/21px "<?php echo $font; ?>", Arial, Helvetica, sans-serif;
- }
- h1, h2, h3, h4, h5 { font-family:'<?php echo $font; ?>', Arial, Helvetica, sans-serif; }
- .logo { background:url(<?php echo $site_logo;
- ?>) no-repeat;
- }
- @media handheld, only screen and (max-width: 767px) {
- .logo {
- background:url(<?php echo $site_logom;
- ?>) no-repeat;
- }
- }
- .articles-block h2 { font:18px/20px "<?php echo $font; ?>", Arial, Helvetica, sans-serif; }
- .title-box h2 { font:22px/28px "<?php echo $font; ?>", Arial, Helvetica, sans-serif;}
- .box h3 { font:16px/20px "<?php echo $font; ?>", Arial, Helvetica, sans-serif; }
- .posts-section h3 { font:16px/20px "<?php echo $font; ?>", Arial, Helvetica, sans-serif; }
- .heading-box h1 { font:22px/26px "<?php echo $font; ?>", Arial, Helvetica, sans-serif;}
- #main h2 { font:26px/30px "<?php echo $font; ?>", Arial, Helvetica, sans-serif; }
- .heading h2 { font:22px/28px "<?php echo $font; ?>", Arial, Helvetica, sans-serif;}
- .comments-section h3 { font:16px/20px "<?php echo $font; ?>", Arial, Helvetica, sans-serif; }
- #sidebar .title h2 { font:16px/20px "<?php echo $font; ?>", Arial, Helvetica, sans-serif; }
- .posts-list h3 { font:13px/14px "<?php echo $font; ?>", Arial, Helvetica, sans-serif; }
- #footer h2 { font:18px/22px "<?php echo $font; ?>", Arial, Helvetica, sans-serif; }
- .articles-block .design { background:url(<?php echo get_template_directory_uri();
- ?>/images/icons/large/<?php echo $icon ?>-white.png) no-repeat;
- }
- .articles-block .customize { background:url(<?php echo get_template_directory_uri();
- ?>/images/icons/large/<?php echo $icon2 ?>-white.png) no-repeat;
- }
- .articles-block .compatibility { background:url(<?php echo get_template_directory_uri();
- ?>/images/icons/large/<?php echo $icon3 ?>-white.png) no-repeat;
- }
- .articles-block .grid { background:url(<?php echo get_template_directory_uri();
- ?>/images/icons/large/<?php echo $icon4 ?>-white.png) no-repeat;
- }
- </style>
- <?php
- if ( is_single() || is_page() ) wp_enqueue_script( 'comment-reply' );
- ?>
- <?php $twitter = of_get_option("social_twitname"); ?>
- <?php $tweets = of_get_option("social_tweets"); ?>
- <!--[if lte IE 9]><link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>css/ie.css" type="text/css" media="screen" /><![endif]-->
- <script type='text/javascript'>
- jQuery(function($){
- $(".tweet").tweet({
- username: "<?php echo $twitter; ?>",
- join_text: "auto",
- count: <?php echo $tweets; ?>,
- auto_join_text_default: "we said,",
- auto_join_text_ed: "we",
- auto_join_text_ing: "we were",
- auto_join_text_reply: "we replied to",
- auto_join_text_url: "",
- loading_text: "loading tweets..."
- });});
- </script>
- <script type="text/javascript">
- $(document).ready(function(){
- $(".search-popup").hide();
- $(".btn-search").show();
- $('.btn-search').click(function(){
- $(".search-popup").slideToggle();
- });
- });
- </script>
- <script type="text/javascript">
- $(window).load(function() {
- show();
- });
- function show() {
- $('#loading').hide();
- $('#carousel').fadeIn();
- };
- </script>
- <?php
- }
- /*---------------------------------*
- /* Content Length Control
- /*---------------------------------*/
- function limited_content($content_length = 250, $allowtags = true, $allowedtags = 25) {
- global $post;
- $content = $post->post_content;
- $content = apply_filters('the_content', $content);
- if (!$allowtags){
- $allowedtags .= '<style>';
- $content = strip_tags($content, $allowedtags);
- }
- $wordarray = explode(' ', $content, $content_length + 1);
- if(count($wordarray) > $content_length) :
- array_pop($wordarray);
- array_push($wordarray, '...<div class="right"><a class="more" href="'. get_permalink() . '">' . __( 'read more','qr' ) . '</a>');
- $content = implode(' ', $wordarray);
- $content .= "</div>";
- endif;
- echo $content;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement