Advertisement
nashproductions

functions.php

Nov 28th, 2012
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 20.40 KB | None | 0 0
  1. <?php
  2. /*--------------------------*
  3. /* Theme Setup
  4. /*--------------------------*/
  5. $themename = "QResponsive";
  6. $shortname = "qr";
  7.        
  8.   if (function_exists('add_theme_support')) {
  9.     add_theme_support('post-thumbnails');
  10.     add_theme_support('automatic-feed-links');
  11.     }
  12.     if(!function_exists("get_custom_body_classes")) {
  13.     function get_custom_body_classes() {
  14.         $classes = array();
  15. }}
  16.  
  17.  
  18. if ( ! isset( $content_width ) ) $content_width = 980;
  19.  
  20. /*----------------------------------------*/
  21. /* Add Editor Stylesheet Support */
  22. /*----------------------------------------*/
  23.  
  24. if ( function_exists('add_editor_style') ) {
  25.     add_editor_style();
  26. }
  27.  
  28. /*--------------------------*
  29. /* A Few Directories
  30. /*--------------------------*/
  31.  
  32. define('QRESPONSIVE_URL', TEMPLATEPATH . '/');
  33. define('QRESPONSIVE_ADMIN', QRESPONSIVE_URL . '/admin');
  34. define('QRESPONSIVE_INCLUDES', QRESPONSIVE_URL . '/includes');
  35.  
  36. /*--------------------------*
  37. /* Image Sizes
  38. /*--------------------------*/
  39.  
  40. add_image_size('Home BPic', 127, 116, true);
  41. add_image_size('Gallery Pic', 352, 245, true);
  42. add_image_size('Gallery1 Pic', 549, 308, true);
  43. add_image_size('Thumbnail Pic', 51, 46, true);
  44. add_image_size('Blog Pic', 837, 400, true);
  45. add_image_size('Logo Pic', '', 80, true);
  46.  
  47. if ( ! isset( $content_width ) ) $content_width = 980;
  48.  
  49. /*--------------------------*
  50. /*  Register Sidebars
  51. /*--------------------------*/
  52.  
  53. if ( function_exists('register_sidebar') )
  54. register_sidebar(array(
  55.         'name' => 'Footer',
  56.         'before_widget' => '<div class="threecol">',
  57.         'after_widget' => '</div>',
  58.         'before_title' => '<h2>',
  59.         'after_title' => '</h2>',
  60. ));
  61.  
  62. register_sidebar(array(
  63.         'name' => 'Sidebar',
  64.         'before_widget' => '<div class="widget-box sidebar-nav">',
  65.         'after_widget' => '</div>',
  66.         'before_title' => '<div class="title"><h2>',
  67.         'after_title' => '</h2></div>',
  68.         'link_before'  => '<span>',
  69.     'link_after'   => '<span>',
  70. ));
  71.  
  72.  
  73. /*--------------------------*
  74. /* Register Scripts
  75. /*--------------------------*/
  76.  
  77. if(!function_exists("qr_scripts")) {
  78.     function qr_scripts() {
  79.          if( is_admin() )
  80.         return;
  81.         $script_directory = get_template_directory_uri();
  82.    
  83.            
  84.         wp_register_script( 'tweet', $script_directory. '/js/jquery.tweet.js',  array( 'jquery') );
  85.         wp_register_script( 'isotope', $script_directory. '/js/jquery.isotope.min.js',  array( 'jquery' ) );
  86.         wp_register_script( 'main', $script_directory. '/js/jquery.main.js', 'jquery' );
  87.         wp_enqueue_script( 'jquery' );
  88.         wp_enqueue_script('tweet');
  89.         wp_enqueue_script('isotope');
  90.         wp_enqueue_script('main');
  91.        
  92.                
  93.     }
  94. }
  95. add_action('init', 'qr_scripts');
  96.  
  97.  
  98. /*--------------------------*
  99. /*  Register Menus
  100. /*--------------------------*/
  101.  
  102. add_action( 'init', 'register_qr_menus' );
  103.  
  104. function register_qr_menus() {
  105.     register_nav_menus(
  106.         array(
  107.             'menu-main' => __( 'Main Menu', 'qr' ),
  108.             'footer-menu' => __( 'Footer Menu', 'qr' ),
  109.         )
  110.     );
  111. }
  112.  
  113. // remove menu container div
  114. function qr_wp_nav_menu_args( $args = '' )
  115. {
  116.     $args['container'] = false;
  117.     return $args;
  118. }
  119. add_filter( 'wp_nav_menu_args', 'qr_wp_nav_menu_args' );
  120.  
  121. /*--------------------------*
  122. /*  Extend Menu Walker
  123. /*--------------------------*/
  124.  
  125. class Qr_Walker_Nav_Menu extends Walker {
  126.     var $tree_type = array( 'post_type', 'taxonomy', 'custom' );
  127.     var $db_fields = array( 'parent' => 'menu_item_parent', 'id' => 'db_id' );
  128.     function start_lvl(&$output, $depth) {
  129.         $indent = str_repeat("\t", $depth);
  130.         $output .= "\n$indent<div class=\"drop-holder\"><div class=\"drop\"><div class=\"holder\"><ul>\n";
  131.     }
  132.     function end_lvl(&$output, $depth) {
  133.         $indent = str_repeat("\t", $depth);
  134.         $output .= "$indent</ul></div></div></div>\n";
  135.     }
  136.     function start_el(&$output, $item, $depth, $args) {
  137.         global $wp_query;
  138.         $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
  139.         $class_names = $value = '';
  140.         $classes = empty( $item->classes ) ? array() : (array) $item->classes;
  141.         $classes = in_array( 'current-menu-item', $classes ) ? array( 'current-menu-item' ) : array();
  142.         $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );
  143.         $class_names = strlen( trim( $class_names ) ) > 0 ? ' class="' . esc_attr( $class_names ) . '"' : '';
  144.         $id = apply_filters( 'nav_menu_item_id', '', $item, $args );
  145.         $id = strlen( $id ) ? ' id="' . esc_attr( $id ) . '"' : '';
  146.         if( $depth == 0 )
  147.             $output .= $indent . '<li' . $id . $value . $class_names .'><div>';
  148.         else
  149.             $output .= $indent . '<li' . $id . $value . $class_names .'>';
  150.         $attributes  = ! empty( $item->attr_title ) ? ' title="'  . esc_attr( $item->attr_title ) .'"' : '';
  151.         $attributes .= ! empty( $item->target )     ? ' target="' . esc_attr( $item->target     ) .'"' : '';
  152.         $attributes .= ! empty( $item->xfn )        ? ' rel="'    . esc_attr( $item->xfn        ) .'"' : '';
  153.         $attributes .= ! empty( $item->url )        ? ' href="'   . esc_attr( $item->url        ) .'"' : '';
  154.         $item_output = $args->before;
  155.         $item_output .= '<a'. $attributes .'><span></span>';
  156.         $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
  157.         $item_output .= '</a>';
  158.         $item_output .= $args->after;
  159.         $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
  160.     }
  161.     function end_el(&$output, $item, $depth) {
  162.         if( $depth == 0 )
  163.             $output .= "</div></li>\n";
  164.         else
  165.             $output .= "</li>\n";
  166.     }
  167. }
  168.  
  169. /*--------------------------*
  170. /*  Extend Mobile Menu Walker
  171. /*--------------------------*/
  172.  
  173. class Qr_Mobile_Walker_Nav_Menu extends Walker {
  174.     var $tree_type = array( 'post_type', 'taxonomy', 'custom' );
  175.     var $db_fields = array( 'parent' => 'menu_item_parent', 'id' => 'db_id' );
  176.     function start_lvl(&$output, $depth) {
  177.         $indent = str_repeat("\t", $depth);
  178.         $output .= "\n$indent<div class=\"drop-holder\"><div class=\"drop\"><div class=\"holder \"><ul>\n";
  179.     }
  180.     function end_lvl(&$output, $depth) {
  181.         $indent = str_repeat("\t", $depth);
  182.         $output .= "$indent</ul></div></div></div>\n";
  183.     }
  184.     function start_el(&$output, $item, $depth, $args) {
  185.         global $wp_query;
  186.         $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
  187.         $class_names = $value = '';
  188.         $classes = empty( $item->classes ) ? array() : (array) $item->classes;
  189.         $classes = in_array( 'current-menu-item', $classes ) ? array( 'current-menu-item' ) : array();
  190.         $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );
  191.         $class_names = strlen( trim( $class_names ) ) > 0 ? ' class="' . esc_attr( $class_names ) . '"' : '';
  192.         $id = apply_filters( 'nav_menu_item_id', '', $item, $args );
  193.         $id = strlen( $id ) ? ' id="' . esc_attr( $id ) . '"' : '';
  194.         $output .= $indent . '<li' . $id . $value . $class_names .'>';
  195.         $attributes  = ! empty( $item->attr_title ) ? ' title="'  . esc_attr( $item->attr_title ) .'"' : '';
  196.         $attributes .= ! empty( $item->target )     ? ' target="' . esc_attr( $item->target     ) .'"' : '';
  197.         $attributes .= ! empty( $item->xfn )        ? ' rel="'    . esc_attr( $item->xfn        ) .'"' : '';
  198.         $attributes .= ! empty( $item->url )        ? ' href="'   . esc_attr( $item->url        ) .'"' : '';
  199.         $item_output = $args->before;
  200.         $item_output .= '<a'. $attributes .'><em><span></span>';
  201.         $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
  202.         $item_output .= '</em></a>';
  203.         $item_output .= $args->after;
  204.         $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
  205.     }
  206.     function end_el(&$output, $item, $depth) {
  207.         $output .= "</li>\n";
  208.     }
  209. }
  210.  
  211. require_once(QRESPONSIVE_INCLUDES . '/breadcrumbs/breadcrumbs.php');
  212.  
  213. /*--------------------------*
  214. /*  Register Post Types
  215. /*--------------------------*/
  216.  
  217. register_post_type('slider', array(
  218.   'label' => __('Slider', 'slider'),
  219.   'name' => __('Slider', 'slider'),
  220.   'singular_label' => __('Slider', 'slider'),
  221.   'public' => true,
  222.   'show_ui' => true,
  223.   'capability_type' => 'post',
  224.   'hierarchical' => false,
  225.   'rewrite' => array('slug' => 'slider'),
  226.   'query_var' => false,
  227.   'menu_icon' => get_template_directory_uri(). '/images/functions/slide-ico.png',
  228.   'supports' => array('title', 'editor', 'author','thumbnail')
  229. ));
  230.  
  231.  
  232. register_post_type('gallery', array(
  233.   'label' => __('Gallery', 'gallery'),
  234.   'name' => __('Gallery', 'gallery'),
  235.   'singular_label' => __('Gallery', 'gallery'),
  236.   'public' => true,
  237.   'has_archive' => false,
  238.   'show_ui' => true,
  239.   'capability_type' => 'post',
  240.   'hierarchical' => true,
  241.   'rewrite' => array('slug' => 'gallery', 'with_front' => false),
  242.   'query_var' => false,
  243.    'menu_icon' => get_template_directory_uri(). '/images/functions/port-ico.png',
  244.   'supports' => array('title','editor','author','thumbnail','custom-fields', 'excerpt','page-attributes'),
  245.   'taxonomies' => array('category', 'post_tag' ),
  246. ));
  247.  
  248. register_post_type('testimonial', array(
  249.   'label' => __('Testimonials', 'testimonial'),
  250.   'name' => __('Testimonials', 'testimonial'),
  251.   'singular_label' => __('Testimonial', 'testimonial'),
  252.   'add_new' => __('Add New', 'testimonial'),
  253.   'add_new_item' => __('Add New Testimonial', 'testimonial'),
  254.   'edit_item' => __('Edit Testimonial', 'testimonial'),
  255.   'new_item' => __('New Testimonial', 'testimonial'),
  256.   'public' => true,
  257.   'has_archive' => false,
  258.   'capability_type' => 'post',
  259.   'menu_icon' => get_template_directory_uri(). '/images/functions/testimonials-ico.png',
  260.   'supports' => array('title', 'editor'),
  261.   ));
  262.  
  263.   register_post_type('team', array(
  264.   'label' => __('Team', 'team'),
  265.   'name' => __('Team', 'team'),
  266.   'singular_label' => __('Team', 'team'),
  267.   'add_new' => __('Add New', 'team'),
  268.   'add_new_item' => __('Add New Team Member', 'team'),
  269.   'edit_item' => __('Edit Team', 'team'),
  270.   'new_item' => __('New Team', 'team'),
  271.   'public' => true,
  272.   'has_archive' => false,
  273.   'capability_type' => 'post',
  274.   'menu_icon' => get_template_directory_uri(). '/images/functions/team-ico.png',
  275.   'supports' => array('title', 'editor', 'excerpt','thumbnail'),
  276.   ));
  277.  
  278.    
  279. add_action('init', 'gallery_add_default_boxes');
  280.  
  281. function gallery_add_default_boxes() {
  282.    
  283.     register_taxonomy_for_object_type('post_tag', 'gallery');
  284.     register_taxonomy("gallery_categories", array("gallery"), array("hierarchical" => true, "label" => "gallery Categories", "rewrite" => true));
  285. }
  286. add_filter('pre_get_posts', 'query_post_type');
  287. function query_post_type($query) {
  288.   if ( is_category() || is_tag() && empty( $query->query_vars['suppress_filters'] ) ) {
  289.     $post_type = get_query_var('post_type');
  290.     if($post_type)
  291.         $post_type = $post_type;
  292.     else
  293.         $post_type = array('post','gallery','nav_menu_item');
  294.     $query->set('post_type',$post_type);
  295.     return $query;
  296.     }
  297. }
  298.  
  299. /*-----------------------------*
  300. /* Relabel Featured Image boxes
  301. /*-----------------------------*/
  302.  
  303. function swap_featured_image_metabox($translation, $text, $domain) {
  304.     global $post;
  305.    
  306.     $translations = get_translations_for_domain( $domain);
  307.  
  308.     if( isset($post->post_type) )
  309.     {
  310.         switch( $post->post_type )
  311.         {
  312.             case 'team':
  313.                 if ( $text == 'Featured Image')
  314.                     return $translations->translate( 'Team Member Photo' );
  315.                 break;
  316.             case 'slider':
  317.                 if ( $text == 'Featured Image')
  318.                     return $translations->translate( 'Slide Image' );
  319.                 break;
  320.             case 'gallery':
  321.                 if ( $text == 'Featured Image')
  322.                     return $translations->translate( 'Gallery Photo' );
  323.                 break;
  324.         }
  325.     }
  326.  
  327.     if ( $text == 'Set featured image')
  328.         return $translations->translate( 'Select an image' );
  329.    
  330.     return $translation;
  331.    
  332. }
  333. add_filter('gettext', 'swap_featured_image_metabox', 10, 4);
  334.  
  335. /*--------------------------*
  336. /* Load Option Panel
  337. /*--------------------------*/
  338.  
  339. if ( !function_exists( 'optionsframework_init' ) ) {
  340.     define( 'OPTIONS_FRAMEWORK_DIRECTORY', get_template_directory_uri() . '/admin/' );
  341.     require_once dirname( __FILE__ ) . '/admin/options-framework.php';
  342. }
  343.  
  344.  
  345. /*--------------------------*
  346. /* Tags/Comments
  347. /*--------------------------*/
  348.  
  349. require_once(QRESPONSIVE_INCLUDES . '/tags-comments/tags.php');
  350.  
  351. /*--------------------------*
  352. /* Custom Avatar
  353. /*--------------------------*/
  354.  
  355.  
  356. add_filter( 'avatar_defaults', 'newgravatar' );
  357. function newgravatar ($avatar_defaults) {
  358.     $myavatar = get_stylesheet_directory_uri('template_directory') . '/images/img13.gif';
  359.     $avatar_defaults[$myavatar] = "Theme Image";
  360.     return $avatar_defaults;
  361. }
  362.  
  363. /*--------------------------*
  364. /* Shortcodes
  365. /*--------------------------*/
  366.  
  367. require_once(QRESPONSIVE_ADMIN . '/shortcodes/shortcodes/shortcodes.php');
  368. require_once(QRESPONSIVE_ADMIN . '/shortcodes/ptable/ptable.php');
  369. require_once(QRESPONSIVE_ADMIN . '/shortcodes/buttons/buttons.php');
  370. require_once(QRESPONSIVE_ADMIN . '/shortcodes/accordion/accordion.php');
  371. require_once(QRESPONSIVE_ADMIN . '/shortcodes/icons/icons.php');
  372. require_once(QRESPONSIVE_ADMIN . '/shortcodes/team/team.php');
  373. require_once(QRESPONSIVE_ADMIN . '/shortcodes/columns/columns.php');
  374. require_once(QRESPONSIVE_ADMIN . '/shortcodes/dropcap/dropcap.php');
  375. require_once(QRESPONSIVE_ADMIN . '/shortcodes/notifications/notifications.php');
  376. require_once(QRESPONSIVE_ADMIN . '/shortcodes/tabs/tabs.php');
  377. require_once(QRESPONSIVE_ADMIN . '/shortcodes/code/code.php');
  378. require_once(QRESPONSIVE_ADMIN . '/shortcodes/carousel/carousel.php');
  379. require_once(QRESPONSIVE_ADMIN . '/shortcodes/divider/divider.php');
  380.    
  381.     add_filter('widget_text', 'do_shortcode');
  382.    
  383. /*--------------------------*
  384. /* Metaboxes
  385. /*--------------------------*/
  386.  
  387. require_once(QRESPONSIVE_ADMIN . '/metabox/meta.php');
  388.  
  389. /*--------------------------*
  390. /* Metaboxes
  391. /*--------------------------*/
  392.  
  393. require_once(QRESPONSIVE_ADMIN . '/sidebars/sbars.php');
  394.  
  395. /*--------------------------*
  396. /* Image Size Filter
  397. /*--------------------------*/
  398.  
  399. add_filter( 'post_thumbnail_html', 'remove_width_attribute', 10 );
  400. add_filter( 'image_send_to_editor', 'remove_width_attribute', 10 );
  401.  
  402. function remove_width_attribute( $html ) {
  403.     $html = preg_replace( '/(width|height)=\"\d*\"\s/', "", $html );
  404.     return $html;
  405. }
  406.  
  407. /*--------------------------*
  408. /* Custom Widgets
  409. /*--------------------------*/
  410.  
  411. require_once(QRESPONSIVE_INCLUDES . '/widgets/widgets.php');
  412.  
  413.  
  414. /*--------------------------*
  415. /* Custom Excerpt Length
  416. /*--------------------------*/
  417.  
  418. function excerpt($limit) {
  419.   $excerpt = explode(' ', get_the_excerpt(), $limit);
  420.   if (count($excerpt)>=$limit) {
  421.     array_pop($excerpt);
  422.     $excerpt = implode(" ",$excerpt).'...';
  423.   } else {
  424.     $excerpt = implode(" ",$excerpt);
  425.   }
  426.   $excerpt = preg_replace('`\[[^\]]*\]`','',$excerpt);
  427.   return $excerpt;
  428. }
  429.  
  430. function content($limit) {
  431.   $content = explode(' ', get_the_content(), $limit);
  432.   if (count($content)>=$limit) {
  433.     array_pop($content);
  434.     $content = implode(" ",$content).'...';
  435.   } else {
  436.     $content = implode(" ",$content);
  437.   }
  438.   $content = preg_replace('/\[.+\]/','', $content);
  439.   $content = apply_filters('the_content', $content);
  440.   $content = str_replace(']]>', ']]&gt;', $content);
  441.   return $content;
  442. }
  443.  
  444. /*---------------------------------*
  445. /* Inject Google Fonts & some options
  446. /*---------------------------------*/
  447.  
  448. add_action('wp_head', 'qr_head');
  449.  
  450. function qr_head() {?>
  451. <link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=<?php echo of_get_option('font_select', ''); ?>">
  452. <?php
  453. if( is_page_template('page-gallery1.php') || is_page_template('page-gallery2.php') || is_page_template('page-gallery3.php')) {
  454. ?>
  455. <script type="text/javascript">
  456. jQuery(function($) {
  457.     $('a[rel^="#olay"]').overlay({ mask: '#999999' });
  458. });
  459. </script>
  460. <?php
  461. }
  462. ?>
  463. <?php if( of_get_option('qr_favicon','true')): { ?>
  464. <link rel="shortcut icon" href="<?php echo of_get_option('qr_favicon',''); ?>" />
  465. <?php }  endif;?>
  466. <?php
  467.     $icon = of_get_option('box1_img', '');
  468.     $icon2 = of_get_option('box2_img', '');
  469.     $icon3 = of_get_option('box3_img', '');
  470.     $icon4 = of_get_option('box4_img', '');
  471.     $font = of_get_option('font_select', '');
  472.     $font_size = of_get_option('font_size', '');
  473.     $site_logo = of_get_option('qr_logo','');
  474.     $site_logom = of_get_option('qr_logom','');
  475.     ?>
  476. <style type="text/css">
  477. body {  font:<?php echo $font_size;
  478. ?>/21px "<?php echo $font; ?>", Arial, Helvetica, sans-serif;
  479. }
  480. h1, h2, h3, h4, h5 { font-family:'<?php echo $font; ?>', Arial, Helvetica, sans-serif; }
  481. .logo { background:url(<?php echo $site_logo;
  482. ?>) no-repeat;
  483. }
  484.  @media handheld, only screen and (max-width: 767px) {
  485.  .logo {
  486. background:url(<?php echo $site_logom;
  487. ?>) no-repeat;
  488. }
  489. }
  490. .articles-block h2 { font:18px/20px "<?php echo $font; ?>", Arial, Helvetica, sans-serif; }
  491. .title-box h2 { font:22px/28px "<?php echo $font; ?>", Arial, Helvetica, sans-serif;}
  492. .box h3 { font:16px/20px "<?php echo $font; ?>", Arial, Helvetica, sans-serif; }
  493. .posts-section h3 { font:16px/20px "<?php echo $font; ?>", Arial, Helvetica, sans-serif; }
  494. .heading-box h1 { font:22px/26px "<?php echo $font; ?>", Arial, Helvetica, sans-serif;}
  495. #main h2 { font:26px/30px "<?php echo $font; ?>", Arial, Helvetica, sans-serif; }
  496. .heading h2 { font:22px/28px "<?php echo $font; ?>", Arial, Helvetica, sans-serif;}
  497. .comments-section h3 { font:16px/20px "<?php echo $font; ?>", Arial, Helvetica, sans-serif; }
  498. #sidebar .title h2 { font:16px/20px "<?php echo $font; ?>", Arial, Helvetica, sans-serif; }
  499. .posts-list h3 { font:13px/14px "<?php echo $font; ?>", Arial, Helvetica, sans-serif; }
  500. #footer h2 { font:18px/22px "<?php echo $font; ?>", Arial, Helvetica, sans-serif; }
  501. .articles-block .design { background:url(<?php echo get_template_directory_uri();
  502. ?>/images/icons/large/<?php echo $icon ?>-white.png) no-repeat;
  503. }
  504. .articles-block .customize { background:url(<?php echo get_template_directory_uri();
  505. ?>/images/icons/large/<?php echo $icon2 ?>-white.png) no-repeat;
  506. }
  507. .articles-block .compatibility { background:url(<?php echo get_template_directory_uri();
  508. ?>/images/icons/large/<?php echo $icon3 ?>-white.png) no-repeat;
  509. }
  510. .articles-block .grid { background:url(<?php echo get_template_directory_uri();
  511. ?>/images/icons/large/<?php echo $icon4 ?>-white.png) no-repeat;
  512. }
  513. </style>
  514. <?php
  515. if ( is_single() || is_page() ) wp_enqueue_script( 'comment-reply' );
  516.  ?>
  517. <?php $twitter  = of_get_option("social_twitname"); ?>
  518. <?php $tweets  = of_get_option("social_tweets"); ?>
  519. <!--[if lte IE 9]><link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>css/ie.css" type="text/css" media="screen" /><![endif]-->
  520. <script type='text/javascript'>
  521.     jQuery(function($){
  522.             $(".tweet").tweet({
  523.             username: "<?php echo $twitter; ?>",
  524.             join_text: "auto",
  525.             count: <?php echo $tweets; ?>,
  526.             auto_join_text_default: "we said,",
  527.             auto_join_text_ed: "we",
  528.             auto_join_text_ing: "we were",
  529.             auto_join_text_reply: "we replied to",
  530.             auto_join_text_url: "",
  531.             loading_text: "loading tweets..."
  532.         });});
  533.  
  534. </script>
  535. <script type="text/javascript">
  536.  
  537. $(document).ready(function(){
  538.  
  539.         $(".search-popup").hide();
  540.         $(".btn-search").show();
  541.  
  542.     $('.btn-search').click(function(){
  543.     $(".search-popup").slideToggle();
  544.     });
  545.  
  546. });
  547.  
  548. </script>
  549. <script type="text/javascript">
  550. $(window).load(function() {
  551.     show();
  552. });
  553.  
  554.  
  555. function show() {
  556.     $('#loading').hide();
  557.     $('#carousel').fadeIn();
  558. };
  559. </script>
  560. <?php
  561. }
  562.  
  563. /*---------------------------------*
  564. /* Content Length Control
  565. /*---------------------------------*/
  566.  
  567. function limited_content($content_length = 250, $allowtags = true, $allowedtags = 25) {
  568. global $post;
  569. $content = $post->post_content;
  570. $content = apply_filters('the_content', $content);
  571. if (!$allowtags){
  572. $allowedtags .= '<style>';
  573. $content = strip_tags($content, $allowedtags);
  574. }
  575. $wordarray = explode(' ', $content, $content_length + 1);
  576. if(count($wordarray) > $content_length) :
  577. array_pop($wordarray);
  578. array_push($wordarray, '...<div class="right"><a class="more" href="'. get_permalink() . '">' . __( 'read more','qr' ) . '</a>');
  579. $content = implode(' ', $wordarray);
  580. $content .= "</div>";
  581. endif;
  582. echo $content;
  583. }
  584. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement