Advertisement
Guest User

Untitled

a guest
Feb 14th, 2017
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 155.51 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4.  
  5. /*--------------------------------------------------------------------------------------------------
  6.  
  7.  
  8.  
  9. File: functions.php
  10.  
  11.  
  12.  
  13. Description: This is the main functions file for this theme
  14.  
  15. Plesae be carefull when editing this file
  16.  
  17.  
  18.  
  19. --------------------------------------------------------------------------------------------------*/
  20.  
  21.  
  22.  
  23. /*--------------------------------------------------------------------------------------------------
  24.  
  25. Load all files needed for this theme
  26.  
  27. --------------------------------------------------------------------------------------------------*/
  28.  
  29.  
  30.  
  31.  
  32.  
  33. locate_template(array('admin/zn-init.php'), true, true);
  34.  
  35. locate_template(array('admin/framework/function-vt-resize.php'), true, true);
  36.  
  37. locate_template(array('template-helpers/content-page.php'), true, true);
  38.  
  39. locate_template(array('template-helpers/shortcodes.php'), true, true);
  40.  
  41. locate_template(array('woocommerce/zn-woocommerce-init.php'), true, true);
  42.  
  43.  
  44.  
  45.  
  46.  
  47. /*--------------------------------------------------------------------------------------------------
  48.  
  49. Load all options inside $data to be used in the theme
  50.  
  51. --------------------------------------------------------------------------------------------------*/
  52.  
  53.  
  54.  
  55. $data = get_option(OPTIONS);
  56.  
  57.  
  58.  
  59.  
  60.  
  61. /*--------------------------------------------------------------------------------------------------
  62.  
  63. Shortcodes fixer
  64.  
  65. --------------------------------------------------------------------------------------------------*/
  66.  
  67. if ( ! function_exists( 'shortcode_empty_paragraph_fix' ) ) {
  68.  
  69. function shortcode_empty_paragraph_fix($content){
  70.  
  71. $array = array (
  72.  
  73. '<p>[' => '[',
  74.  
  75. ']</p>' => ']',
  76.  
  77. ']<br />' => ']'
  78.  
  79. );
  80.  
  81.  
  82.  
  83. $content = strtr($content, $array);
  84.  
  85. return $content;
  86.  
  87. }
  88.  
  89. }
  90.  
  91.  
  92.  
  93. add_filter('the_content', 'shortcode_empty_paragraph_fix');
  94.  
  95.  
  96.  
  97. /*--------------------------------------------------------------------------------------------------
  98.  
  99. GET THE MEDIA ID FROM URL
  100.  
  101. --------------------------------------------------------------------------------------------------*/
  102.  
  103. function pn_get_attachment_id_from_url( $attachment_url = '' ) {
  104.  
  105.  
  106.  
  107. global $wpdb;
  108.  
  109. $attachment_id = false;
  110.  
  111.  
  112.  
  113. // If there is no url, return.
  114.  
  115. if ( '' == $attachment_url )
  116.  
  117. return;
  118.  
  119.  
  120.  
  121. // Get the upload directory paths
  122.  
  123. $upload_dir_paths = wp_upload_dir();
  124.  
  125.  
  126.  
  127. // Make sure the upload path base directory exists in the attachment URL, to verify that we're working with a media library image
  128.  
  129. if ( false !== strpos( $attachment_url, $upload_dir_paths['baseurl'] ) ) {
  130.  
  131.  
  132.  
  133. // If this is the URL of an auto-generated thumbnail, get the URL of the original image
  134.  
  135. $attachment_url = preg_replace( '/-\d+x\d+(?=\.(jpg|jpeg|png|gif)$)/i', '', $attachment_url );
  136.  
  137.  
  138.  
  139. // Remove the upload path base directory from the attachment URL
  140.  
  141. $attachment_url = str_replace( $upload_dir_paths['baseurl'] . '/', '', $attachment_url );
  142.  
  143.  
  144.  
  145. // Finally, run a custom database query to get the attachment ID from the modified attachment URL
  146.  
  147. $attachment_id = $wpdb->get_var( $wpdb->prepare( "SELECT wposts.ID FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta WHERE wposts.ID = wpostmeta.post_id AND wpostmeta.meta_key = '_wp_attached_file' AND wpostmeta.meta_value = '%s' AND wposts.post_type = 'attachment'", $attachment_url ) );
  148.  
  149.  
  150.  
  151. }
  152.  
  153.  
  154.  
  155. return $attachment_id;
  156.  
  157. }
  158.  
  159. /*--------------------------------------------------------------------------------------------------
  160.  
  161. Check if we are on the taxonomy archive page. We will display all items if it is selected
  162.  
  163. --------------------------------------------------------------------------------------------------*/
  164.  
  165. if ( ! function_exists( 'zn_portfolio_taxonomy_pagination' ) ) {
  166.  
  167. function zn_portfolio_taxonomy_pagination( $query ) {
  168.  
  169.  
  170.  
  171. global $data;
  172.  
  173. if( !empty ( $data['portfolio_per_page'] ) ) {
  174.  
  175.  
  176.  
  177. if ( is_tax('project_category') && $query->is_main_query() ) { //where 'nasc_report' is assumed to be your post type name
  178.  
  179. set_query_var( 'posts_per_page', $data['portfolio_per_page'] );
  180.  
  181. }
  182.  
  183.  
  184.  
  185. }
  186.  
  187. if( !empty ( $data['portfolio_per_page_show'] ) ) {
  188.  
  189.  
  190.  
  191. if ( is_tax('project_category') && $query->is_main_query() ) { //where 'nasc_report' is assumed to be your post type name
  192.  
  193. set_query_var( 'showposts', $data['portfolio_per_page_show'] );
  194.  
  195. }
  196.  
  197.  
  198.  
  199. }
  200.  
  201.  
  202.  
  203. }
  204.  
  205. }
  206.  
  207.  
  208.  
  209. add_action( 'pre_get_posts', 'zn_portfolio_taxonomy_pagination' );
  210.  
  211.  
  212.  
  213. /*--------------------------------------------------------------------------------------------------
  214.  
  215. Show the page builder elements based on area
  216.  
  217. --------------------------------------------------------------------------------------------------*/
  218.  
  219. if ( ! function_exists( 'zn_get_template_from_area' ) ) {
  220.  
  221. function zn_get_template_from_area ($area,$post_id,$meta_fields)
  222.  
  223. {
  224.  
  225.  
  226.  
  227. if ( isset ( $meta_fields[$area] ) )
  228.  
  229. {
  230.  
  231.  
  232.  
  233. global $post;
  234.  
  235. $GLOBALS['meta_fields'] = $meta_fields;
  236.  
  237.  
  238.  
  239. if ( $area == 'content_main_area' || $area == 'content_grey_area' || $area == 'content_bottom_area') {
  240.  
  241. $sizes = array (
  242.  
  243. "four"=>"0.25",
  244.  
  245. "one-third"=>"0.33",
  246.  
  247. "eight"=>"0.5",
  248.  
  249. "two-thirds"=>"0.66",
  250.  
  251. "twelve"=>"0.75",
  252.  
  253. "sixteen"=>"1",
  254.  
  255. );
  256.  
  257.  
  258.  
  259. $size = 0;
  260.  
  261. $i = 0;
  262.  
  263.  
  264.  
  265. $all_elements = count ($meta_fields[$area]);
  266.  
  267. $no_margin = '';
  268.  
  269.  
  270.  
  271. foreach ( $meta_fields[$area] as $options )
  272.  
  273. {
  274.  
  275.  
  276.  
  277. if ($all_elements == 1 && $options['dynamic_element_type'] == '_shop_features'){
  278.  
  279. $no_margin = 'shop-features';
  280.  
  281. }
  282.  
  283.  
  284.  
  285. if ( $size == '0' ) {
  286.  
  287.  
  288.  
  289. // echo $options['_sizer'];
  290.  
  291. //echo 'row_opened';
  292.  
  293. echo '<div class="row '.$no_margin.'">';
  294.  
  295.  
  296.  
  297. }
  298.  
  299.  
  300.  
  301. $options['dynamic_element_type']($options);
  302.  
  303.  
  304.  
  305. if ( isset ( $options['_sizer'] ) ) {
  306.  
  307. $size += $sizes[$options['_sizer']];
  308.  
  309. }
  310.  
  311.  
  312.  
  313. $i++;
  314.  
  315.  
  316.  
  317. if ($size == '1' || $size == '0.99' || $size == '0.91' || $size == '0.88' || $all_elements == $i ) {
  318.  
  319.  
  320.  
  321. echo '</div>';
  322.  
  323. // echo $size;
  324.  
  325. // echo 'row_closed';
  326.  
  327. $size = 0;
  328.  
  329. }
  330.  
  331.  
  332.  
  333. }
  334.  
  335.  
  336.  
  337. }
  338.  
  339. else {
  340.  
  341. foreach ($meta_fields[$area] as $options )
  342.  
  343. {
  344.  
  345. $options['dynamic_element_type']($options);
  346.  
  347. }
  348.  
  349. }
  350.  
  351.  
  352.  
  353. }
  354.  
  355. }
  356.  
  357. }
  358.  
  359.  
  360.  
  361. /*--------------------------------------------------------------------------------------------------
  362.  
  363. Load/set the theme translation files
  364.  
  365. Translations can be filed in the /languages/ directory
  366.  
  367. --------------------------------------------------------------------------------------------------*/
  368.  
  369.  
  370.  
  371. load_theme_textdomain( THEMENAME, get_template_directory() . '/languages' );
  372.  
  373.  
  374.  
  375. /*--------------------------------------------------------------------------------------------------
  376.  
  377. Get the page number
  378.  
  379. --------------------------------------------------------------------------------------------------*/
  380.  
  381. if ( ! function_exists( 'get_page_number' ) ) {
  382.  
  383. function get_page_number() {
  384.  
  385. if ( get_query_var('paged') ) {
  386.  
  387. print ' | ' . __( 'Page ' , THEMENAME) . get_query_var('paged');
  388.  
  389. }
  390.  
  391. }
  392.  
  393. }
  394.  
  395.  
  396.  
  397. /*--------------------------------------------------------------------------------------------------
  398.  
  399. Wrap post images in HoverBorder Class
  400.  
  401. --------------------------------------------------------------------------------------------------*/
  402.  
  403. add_filter('the_content', 'zn_wrap_images');
  404.  
  405. if ( ! function_exists( 'zn_wrap_images' ) ) {
  406.  
  407. function zn_wrap_images ($content)
  408.  
  409. { global $post;
  410.  
  411. $pattern = "/<a(.*?)href=('|\")(.*?).(bmp|gif|jpeg|jpg|png)('|\")(.*?)><img(.*?)class=('|\")(.*?)(.*?)(alignleft|alignright|aligncenter|alignnone)(.*?)('|\")(.*?)>/i";
  412.  
  413. $replacement = '<a$1href=$2$3.$4$5 class="hoverBorder $11"$6><img class="$10$12"$14>';
  414.  
  415. $content = preg_replace($pattern, $replacement, $content);
  416.  
  417. //$content = str_replace("%LIGHTID%", $post->ID, $content);
  418.  
  419. return $content;
  420.  
  421. }
  422.  
  423. }
  424.  
  425.  
  426.  
  427. /*--------------------------------------------------------------------------------------------------
  428.  
  429. Calculate proper size
  430.  
  431. --------------------------------------------------------------------------------------------------*/
  432.  
  433. if ( ! function_exists( 'zn_get_size' ) ) {
  434.  
  435. function zn_get_size( $size ) {
  436.  
  437. global $data;
  438.  
  439. $span_sizes = array (
  440.  
  441. "four"=>"span3",
  442.  
  443. "one-third"=>"span4",
  444.  
  445. "span5"=>"span5",
  446.  
  447. "eight"=>"span6",
  448.  
  449. "two-thirds"=>"span8",
  450.  
  451. "twelve"=>"span9",
  452.  
  453. "sixteen"=>"span12",
  454.  
  455. "portfolio_sortable" => 'portfolio_sortable'
  456.  
  457. );
  458.  
  459.  
  460.  
  461.  
  462.  
  463. // 1170 LAYOUT
  464.  
  465. if ($data['zn_width'] == '1170') {
  466.  
  467.  
  468.  
  469. $image_width = array (
  470.  
  471. "four"=>"270",
  472.  
  473. "one-third"=>"370",
  474.  
  475. "span5"=>"470",
  476.  
  477. "eight"=>"570",
  478.  
  479. "two-thirds"=>"770",
  480.  
  481. "twelve"=>"870",
  482.  
  483. "sixteen"=>"1170",
  484.  
  485. "span2"=>"170",
  486.  
  487. "span3"=>"270",
  488.  
  489. "span4"=>"370",
  490.  
  491. "span5"=>"470",
  492.  
  493. "span6"=>"570",
  494.  
  495. "span7"=>"670",
  496.  
  497. "span8"=>"770",
  498.  
  499. "span9"=>"870",
  500.  
  501. "span10"=>"970",
  502.  
  503. "span11"=>"1070",
  504.  
  505. "span12"=>"1170",
  506.  
  507. "portfolio_sortable" => '260'
  508.  
  509. );
  510.  
  511.  
  512.  
  513.  
  514.  
  515. }
  516.  
  517. // 960 LAYOUT
  518.  
  519. elseif ( $data['zn_width'] == '960' ) {
  520.  
  521.  
  522.  
  523. $image_width = array (
  524.  
  525. "four"=>"220", // DONE
  526.  
  527. "one-third"=>"370",
  528.  
  529. "eight"=>"460", // DONE
  530.  
  531. "two-thirds"=>"770",
  532.  
  533. "twelve"=>"870",
  534.  
  535. "sixteen"=>"960", // DONE
  536.  
  537. "span3"=>"220", // DONE
  538.  
  539. "span4"=>"300", // DONE
  540.  
  541. "span5"=>"460",
  542.  
  543. "span6"=>"460", // DONE
  544.  
  545. "span7"=>"670",
  546.  
  547. "span8"=>"770",
  548.  
  549. "span9"=>"870",
  550.  
  551. "span10"=>"970",
  552.  
  553. "span11"=>"1070",
  554.  
  555. "span12"=>"960", // DONE
  556.  
  557. "portfolio_sortable" => '210'
  558.  
  559. );
  560.  
  561.  
  562.  
  563. }
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571. $n_height = $image_width[$size]/(16/9);
  572.  
  573.  
  574.  
  575. //echo $sizes[$size];
  576.  
  577.  
  578.  
  579. $new_size = array();
  580.  
  581. if ( isset ( $span_sizes[$size] ) ) {
  582.  
  583. $new_size['sizer'] = $span_sizes[$size];
  584.  
  585. }
  586.  
  587. if ( isset ( $image_width[$size] ) ) {
  588.  
  589. $new_size['width'] = $image_width[$size];
  590.  
  591. }
  592.  
  593.  
  594.  
  595. $new_size['height'] = $n_height;
  596.  
  597.  
  598.  
  599. //echo $new_size['height'];
  600.  
  601. return $new_size;
  602.  
  603.  
  604.  
  605. }
  606.  
  607. }
  608.  
  609.  
  610.  
  611.  
  612.  
  613.  
  614.  
  615. /*--------------------------------------------------------------------------------------------------
  616.  
  617. SET THE CONTENT WIDTH
  618.  
  619. --------------------------------------------------------------------------------------------------*/
  620.  
  621.  
  622.  
  623. if ( ! isset( $content_width ) )
  624.  
  625. $content_width = 1170;
  626.  
  627.  
  628.  
  629. if ( ! function_exists( 'zn_adjust_content_width' ) ) {
  630.  
  631. function zn_adjust_content_width() {
  632.  
  633. global $content_width,$data;
  634.  
  635.  
  636.  
  637. // 1170 LAYOUT
  638.  
  639. if ( $data['zn_width'] == '960' ) {
  640.  
  641.  
  642.  
  643. $content_width = 960;
  644.  
  645.  
  646.  
  647. }
  648.  
  649.  
  650.  
  651. }
  652.  
  653. }
  654.  
  655. add_action( 'template_redirect', 'zn_adjust_content_width' );
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663. /*--------------------------------------------------------------------------------------------------
  664.  
  665. OVERRIDE WORDPRESS POST GALLERY SHORTCODE
  666.  
  667. --------------------------------------------------------------------------------------------------*/
  668.  
  669. remove_shortcode('gallery', 'gallery_shortcode');
  670.  
  671.  
  672.  
  673. if ( ! function_exists( 'zn_custom_gallery' ) ) {
  674.  
  675. function zn_custom_gallery($attr) {
  676.  
  677. global $post;
  678.  
  679.  
  680.  
  681. static $instance = 0;
  682.  
  683. $instance++;
  684.  
  685.  
  686.  
  687. if ( ! empty( $attr['ids'] ) ) {
  688.  
  689. // 'ids' is explicitly ordered, unless you specify otherwise.
  690.  
  691. if ( empty( $attr['orderby'] ) )
  692.  
  693. $attr['orderby'] = 'post__in';
  694.  
  695. $attr['include'] = $attr['ids'];
  696.  
  697. }
  698.  
  699.  
  700.  
  701. // We're trusting author input, so let's at least make sure it looks like a valid orderby statement
  702.  
  703. if ( isset( $attr['orderby'] ) ) {
  704.  
  705. $attr['orderby'] = sanitize_sql_orderby( $attr['orderby'] );
  706.  
  707. if ( !$attr['orderby'] )
  708.  
  709. unset( $attr['orderby'] );
  710.  
  711. }
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719. extract(shortcode_atts(array(
  720.  
  721. 'order' => 'ASC',
  722.  
  723. 'orderby' => 'menu_order ID',
  724.  
  725. 'id' => $post->ID,
  726.  
  727. 'itemtag' => 'dl',
  728.  
  729. 'icontag' => 'dt',
  730.  
  731. 'captiontag' => 'dd',
  732.  
  733. 'columns' => 3,
  734.  
  735. 'size' => 'thumbnail',
  736.  
  737. 'include' => '',
  738.  
  739. 'exclude' => ''
  740.  
  741. ), $attr));
  742.  
  743.  
  744.  
  745. $id = intval($id);
  746.  
  747. if ( 'RAND' == $order )
  748.  
  749. $orderby = 'none';
  750.  
  751.  
  752.  
  753. if ( !empty($include) ) {
  754.  
  755. $_attachments = get_posts( array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );
  756.  
  757.  
  758.  
  759. $attachments = array();
  760.  
  761. foreach ( $_attachments as $key => $val ) {
  762.  
  763. $attachments[$val->ID] = $_attachments[$key];
  764.  
  765. }
  766.  
  767. } elseif ( !empty($exclude) ) {
  768.  
  769. $attachments = get_children( array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );
  770.  
  771. } else {
  772.  
  773. $attachments = get_children( array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );
  774.  
  775. }
  776.  
  777.  
  778.  
  779. if ( empty($attachments) )
  780.  
  781. return '';
  782.  
  783.  
  784.  
  785. if ( is_feed() ) {
  786.  
  787. $output = "\n";
  788.  
  789. foreach ( $attachments as $att_id => $attachment )
  790.  
  791. $output .= wp_get_attachment_link($att_id, $size, true) . "\n";
  792.  
  793. return $output;
  794.  
  795. }
  796.  
  797.  
  798.  
  799. $itemtag = tag_escape($itemtag);
  800.  
  801. $captiontag = tag_escape($captiontag);
  802.  
  803. $icontag = tag_escape($icontag);
  804.  
  805. $valid_tags = wp_kses_allowed_html( 'post' );
  806.  
  807. if ( ! isset( $valid_tags[ $itemtag ] ) )
  808.  
  809. $itemtag = 'dl';
  810.  
  811. if ( ! isset( $valid_tags[ $captiontag ] ) )
  812.  
  813. $captiontag = 'dd';
  814.  
  815. if ( ! isset( $valid_tags[ $icontag ] ) )
  816.  
  817. $icontag = 'dt';
  818.  
  819.  
  820.  
  821. $columns = intval($columns);
  822.  
  823. $itemwidth = $columns > 0 ? floor(100/$columns) : 100;
  824.  
  825. $float = is_rtl() ? 'right' : 'left';
  826.  
  827.  
  828.  
  829. $selector = "gallery-{$instance}";
  830.  
  831.  
  832.  
  833. $gallery_style = $gallery_div = '';
  834.  
  835. if ( apply_filters( 'use_default_gallery_style', true ) )
  836.  
  837. $gallery_style = "
  838.  
  839. <style type='text/css'>
  840.  
  841. #{$selector} {
  842.  
  843. margin: auto;
  844.  
  845. }
  846.  
  847. #{$selector} .gallery-item {
  848.  
  849. float: {$float};
  850.  
  851. margin-top: 10px;
  852.  
  853. text-align: center;
  854.  
  855. width: {$itemwidth}%;
  856.  
  857. }
  858.  
  859. #{$selector} img {
  860.  
  861. border: 2px solid #cfcfcf;
  862.  
  863. }
  864.  
  865. #{$selector} .gallery-caption {
  866.  
  867. margin-left: 0;
  868.  
  869. }
  870.  
  871. </style>
  872.  
  873. <!-- see gallery_shortcode() in wp-includes/media.php -->";
  874.  
  875. $size_class = sanitize_html_class( $size );
  876.  
  877. $gallery_div = "<div id='$selector' class='gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}'>";
  878.  
  879. $output = apply_filters( 'gallery_style', $gallery_style . "\n\t\t" . $gallery_div );
  880.  
  881. $num_ids = count( $attachments );
  882.  
  883.  
  884.  
  885. $i = 1;
  886.  
  887. $c = 1;
  888.  
  889.  
  890.  
  891.  
  892.  
  893. $num_columns = 12/$columns;
  894.  
  895. $uid = uniqid('pp_');
  896.  
  897. foreach ( $attachments as $id => $attachment ) {
  898.  
  899.  
  900.  
  901.  
  902.  
  903. if ( $c == 1 || $c % ($columns+1) == 0 ) {
  904.  
  905. $output .= '<div class="row-fluid zn_image_gallery">';
  906.  
  907. $c = 1;
  908.  
  909. }
  910.  
  911.  
  912.  
  913. if ( $captiontag && trim($attachment->post_excerpt) ) {
  914.  
  915. $title_caption = wptexturize($attachment->post_excerpt);
  916.  
  917. }
  918.  
  919. else {
  920.  
  921. $title_caption = '';
  922.  
  923. }
  924.  
  925.  
  926.  
  927. $output .= '<div class="span'.$num_columns.'">';
  928.  
  929.  
  930.  
  931. $output .= '<a rel="prettyPhoto['.$uid.']" href="'.wp_get_attachment_url($id).'" title="'.$title_caption.'" class="hoverBorder">';
  932.  
  933. $output .= wp_get_attachment_image( $id, $size, 0, $attr );
  934.  
  935. $output .= '</a>';
  936.  
  937.  
  938.  
  939. $output .= '</div>';
  940.  
  941.  
  942.  
  943.  
  944.  
  945. if ( ( $columns > 0 && $i % $columns == 0 ) || $i == $num_ids )
  946.  
  947. $output .= '</div>';
  948.  
  949. $i++;
  950.  
  951. $c++;
  952.  
  953. }
  954.  
  955.  
  956.  
  957. return $output;
  958.  
  959. }
  960.  
  961. }
  962.  
  963.  
  964.  
  965. add_shortcode('gallery', 'zn_custom_gallery');
  966.  
  967.  
  968.  
  969. //add_theme_support('post-formats', array( 'aside', 'chat', 'gallery', 'image', 'link', 'quote', 'status', 'video', 'audio'));
  970.  
  971. /*--------------------------------------------------------------------------------------------------
  972.  
  973. Logo SEO function
  974.  
  975. --------------------------------------------------------------------------------------------------*/
  976.  
  977. if ( ! function_exists( 'zn_logo' ) ) {
  978.  
  979. function zn_logo(){
  980.  
  981.  
  982.  
  983. global $data;
  984.  
  985.  
  986.  
  987. $logo = '';
  988.  
  989.  
  990.  
  991. if ( empty( $data['head_show_logo'] ) || (!empty( $data['head_show_logo'] ) && $data['head_show_logo'] == 'yes') ) {
  992.  
  993. if ( is_front_page() ) {
  994.  
  995. if ( isset ( $data['logo_upload'] ) && !empty ( $data['logo_upload'] ) ) {
  996.  
  997. $logo = '<h1 id="logo"><a href="'.home_url().'"><img src="'.$data['logo_upload'].'" alt="'.get_bloginfo('description').'" /></a></h1>';
  998.  
  999. }
  1000.  
  1001. else {
  1002.  
  1003. $logo = '<h1 id="logo"><a href="'.home_url().'">'.get_bloginfo('name').'</a></h1>';
  1004.  
  1005. }
  1006.  
  1007. }
  1008.  
  1009. else {
  1010.  
  1011. if ( isset ( $data['logo_upload'] ) && !empty ( $data['logo_upload'] ) ) {
  1012.  
  1013. $logo = '<h3 id="logo"><a href="'.home_url().'"><img src="'.$data['logo_upload'].'" alt="'.get_bloginfo('description').'" /></a></h3>';
  1014.  
  1015. }
  1016.  
  1017. else {
  1018.  
  1019. $logo = '<h3 id="logo"><a href="'.home_url().'">'.get_bloginfo('name').'</a></h3>';
  1020.  
  1021. }
  1022.  
  1023. }
  1024.  
  1025. }
  1026.  
  1027.  
  1028.  
  1029. return $logo;
  1030.  
  1031.  
  1032.  
  1033. }
  1034.  
  1035. }
  1036.  
  1037.  
  1038.  
  1039. /*--------------------------------------------------------------------------------------------------
  1040.  
  1041. Favicon function
  1042.  
  1043. --------------------------------------------------------------------------------------------------*/
  1044.  
  1045. if ( ! function_exists( 'zn_favicon' ) ) {
  1046.  
  1047. function zn_favicon(){
  1048.  
  1049.  
  1050.  
  1051. global $data;
  1052.  
  1053.  
  1054.  
  1055. if(isset($data['custom_favicon']) && !empty($data['custom_favicon'])){
  1056.  
  1057. $favicon = '<link rel="shortcut icon" href="'.$data['custom_favicon'].'" type="image/vnd.microsoft.icon"/>';
  1058.  
  1059. $favicon = '<link rel="icon" href="'.$data['custom_favicon'].'" type="image/x-ico"/>';
  1060.  
  1061. } else {
  1062.  
  1063. $favicon = '<link rel="shortcut icon" href="'.get_bloginfo('template_directory').'/images/favicons/favicon.png" type="image/vnd.microsoft.icon"/>';
  1064.  
  1065. $favicon = '<link rel="icon" href="'.get_bloginfo('template_directory').'/images/favicons/favicon.png" type="image/x-ico"/>';
  1066.  
  1067. }
  1068.  
  1069.  
  1070.  
  1071. echo $favicon;
  1072.  
  1073.  
  1074.  
  1075. }
  1076.  
  1077. }
  1078.  
  1079. add_action('admin_head','zn_favicon');
  1080.  
  1081.  
  1082.  
  1083. /*--------------------------------------------------------------------------------------------------
  1084.  
  1085. Load the css for the theme
  1086.  
  1087. --------------------------------------------------------------------------------------------------*/
  1088.  
  1089. if ( ! function_exists( 'zn_add_styles' ) ) {
  1090.  
  1091. function zn_add_styles()
  1092.  
  1093. {
  1094.  
  1095. global $data;
  1096.  
  1097.  
  1098.  
  1099. if (!is_admin())
  1100.  
  1101. {
  1102.  
  1103.  
  1104.  
  1105. wp_enqueue_style('zn-bootstrapcss', get_template_directory_uri() . '/css/bootstrap.css',array() ,false,'all');
  1106.  
  1107.  
  1108.  
  1109. // Superfish menu
  1110.  
  1111. wp_enqueue_style('zn-superfish', get_template_directory_uri() . '/addons/superfish_responsive/superfish.css',array() ,false,'all');
  1112.  
  1113.  
  1114.  
  1115. // TEMPLATE MAIN STYLE
  1116.  
  1117. wp_enqueue_style('zn-templtecss', get_template_directory_uri() . '/css/template.css',array() ,false,'all');
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123. // if responsive
  1124.  
  1125. if ( $data['zn_responsive'] == 'yes' ) {
  1126.  
  1127.  
  1128.  
  1129. wp_enqueue_style('zn-bootstrap-responsivecss', get_template_directory_uri() . '/css/bootstrap-responsive.css',array() ,false,'all');
  1130.  
  1131.  
  1132.  
  1133. }
  1134.  
  1135. //if not
  1136.  
  1137. else {
  1138.  
  1139. // 1170 LAYOUT
  1140.  
  1141. if ($data['zn_width'] == '1170') {
  1142.  
  1143. // this will contain override of the grid (no media query inside)
  1144.  
  1145. wp_enqueue_style('zn-bootstrap-1170css', get_template_directory_uri() . '/css/bootstrap-1170.css',array() ,false,'all');
  1146.  
  1147.  
  1148.  
  1149. }
  1150.  
  1151. // 960 LAYOUT
  1152.  
  1153. else {
  1154.  
  1155.  
  1156.  
  1157. //wp_enqueue_style('zn-tweacks960', get_template_directory_uri() . '/css/bootstrap-960.css',array() ,false,'all');
  1158.  
  1159.  
  1160.  
  1161. }
  1162.  
  1163.  
  1164.  
  1165. }
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171. // Pretty Photo
  1172.  
  1173. wp_enqueue_style('pretty_photo', get_template_directory_uri() . '/addons/prettyphoto/prettyPhoto.css',array() ,false,'all');
  1174.  
  1175.  
  1176.  
  1177. // Superfish menu
  1178.  
  1179. wp_enqueue_style('zn-superfish', get_template_directory_uri() . '/addons/superfish_responsive/superfish.css',array() ,false,'all');
  1180.  
  1181.  
  1182.  
  1183. // Main Wordpress style
  1184.  
  1185. wp_enqueue_style('theme_style', get_stylesheet_directory_uri() . '/style.css?v=2010401',array() ,false,'all');
  1186.  
  1187.  
  1188.  
  1189. //wp_enqueue_style('Lato_default', '//fonts.googleapis.com/css?family=Lato:300,400,700,900&amp;v1&mp;subset=latin,latin-ext', false, 1.0, 'screen');
  1190.  
  1191. //wp_enqueue_style('Open+Sans_default', '//fonts.googleapis.com/css?family=Open+Sans:400,400italic,700&amp;v1&mp;subset=latin,latin-ext', false, 1.0, 'screen');
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197. /* Load Google Fonts if they are needed */
  1198.  
  1199. $normal_faces = array('arial','verdana','trebuchet','georgia','times','tahoma','palatino','helvetica');
  1200.  
  1201.  
  1202.  
  1203. if( is_array( $data['fonts'] ) ) {
  1204.  
  1205. $data['fonts'] = array_unique( $data['fonts'] );
  1206.  
  1207. }
  1208.  
  1209. else {
  1210.  
  1211. $data['fonts'] = array();
  1212.  
  1213. }
  1214.  
  1215.  
  1216.  
  1217. //print_r($data['fonts']);
  1218.  
  1219.  
  1220.  
  1221. $one_array_font = array();
  1222.  
  1223.  
  1224.  
  1225. foreach($data['fonts'] as $key => $font){
  1226.  
  1227.  
  1228.  
  1229. if(!in_array($font,$normal_faces)) {
  1230.  
  1231. $font = str_replace(' ', '+', $font);
  1232.  
  1233. $one_array_font[] = $font;
  1234.  
  1235. }
  1236.  
  1237. }
  1238.  
  1239.  
  1240.  
  1241. $gfont = implode('|', $one_array_font);
  1242.  
  1243.  
  1244.  
  1245. $subset = '';
  1246.  
  1247. if ( !empty ( $data['g_fonts_subset'] ) ) {
  1248.  
  1249.  
  1250.  
  1251. $subset = '&subset='.str_replace( ' ' , '' , $data['g_fonts_subset']);
  1252.  
  1253. }
  1254.  
  1255.  
  1256.  
  1257. wp_enqueue_style( $font, '//fonts.googleapis.com/css?family='.$gfont.''.$subset);
  1258.  
  1259.  
  1260.  
  1261.  
  1262.  
  1263. if ( $data['zn_main_style'] == 'dark' ) {
  1264.  
  1265.  
  1266.  
  1267. wp_enqueue_style('zn-dark-style', get_template_directory_uri() . '/css/dark-theme.css',array() ,false,'all');
  1268.  
  1269.  
  1270.  
  1271. }
  1272.  
  1273.  
  1274.  
  1275. // Generated css file - The options needs to be saved in order to generate new file
  1276.  
  1277.  
  1278.  
  1279. if(is_multisite()) {
  1280.  
  1281. $uploads = wp_upload_dir();
  1282.  
  1283. wp_enqueue_style('options', $uploads['baseurl'] . '/options.css', 'style');
  1284.  
  1285. } else {
  1286.  
  1287. wp_enqueue_style('options', get_template_directory_uri() . '/css/options.css', 'style');
  1288.  
  1289. }
  1290.  
  1291.  
  1292.  
  1293. }
  1294.  
  1295. }
  1296.  
  1297. }
  1298.  
  1299. add_action('wp_enqueue_scripts','zn_add_styles');
  1300.  
  1301.  
  1302.  
  1303. /*--------------------------------------------------------------------------------------------------
  1304.  
  1305. Remove version query from files
  1306.  
  1307. --------------------------------------------------------------------------------------------------*/
  1308.  
  1309. function _remove_script_version( $src ){
  1310.  
  1311. return remove_query_arg( 'ver', $src );
  1312.  
  1313. }
  1314.  
  1315. add_filter( 'script_loader_src', '_remove_script_version', 15, 1 );
  1316.  
  1317. add_filter( 'style_loader_src', '_remove_script_version', 15, 1 );
  1318.  
  1319.  
  1320.  
  1321. /*--------------------------------------------------------------------------------------------------
  1322.  
  1323. Add extra data to head
  1324.  
  1325. --------------------------------------------------------------------------------------------------*/
  1326.  
  1327. if ( ! function_exists( 'zn_head' ) ) {
  1328.  
  1329. function zn_head() {
  1330.  
  1331. global $data;
  1332.  
  1333. ?>
  1334.  
  1335. <!--[if lte IE 9]>
  1336.  
  1337. <link rel="stylesheet" type="text/css" href="<?php echo MASTER_THEME_DIR; ?>/css/fixes.css" />
  1338.  
  1339. <![endif]-->
  1340.  
  1341.  
  1342.  
  1343.  
  1344.  
  1345. <!--[if lte IE 8]>
  1346.  
  1347. <script src="js/respond.js"></script>
  1348.  
  1349. <script type="text/javascript">
  1350.  
  1351. var $buoop = {
  1352.  
  1353. vs: {
  1354.  
  1355. i: 8,
  1356.  
  1357. f: 6,
  1358.  
  1359. o: 10.6,
  1360.  
  1361. s: 4,
  1362.  
  1363. n: 9
  1364.  
  1365. }
  1366.  
  1367. }
  1368.  
  1369. $buoop.ol = window.onload;
  1370.  
  1371. window.onload = function () {
  1372.  
  1373. try {
  1374.  
  1375. if ($buoop.ol) $buoop.ol();
  1376.  
  1377. } catch (e) {}
  1378.  
  1379. var e = document.createElement("script");
  1380.  
  1381. e.setAttribute("type", "text/javascript");
  1382.  
  1383. e.setAttribute("src", "http://browser-update.org/update.js");
  1384.  
  1385. document.body.appendChild(e);
  1386.  
  1387. }
  1388.  
  1389. </script>
  1390.  
  1391. <![endif]-->
  1392.  
  1393.  
  1394.  
  1395. <?php
  1396.  
  1397.  
  1398.  
  1399. if ($data['face_og']) {
  1400.  
  1401. ?>
  1402.  
  1403. <!-- Facebook OpenGraph Tags - Replace with your own -->
  1404.  
  1405. <meta property="og:title" content="<?php zn_opengraph_default_title();?>"/>
  1406.  
  1407. <meta property="og:type" content="<?php zn_opengraph_default_type();?>"/>
  1408.  
  1409. <meta property="og:url" content="<?php echo "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];?>"/>
  1410.  
  1411. <?php opengraph_default_image();?>
  1412.  
  1413. <meta property="og:site_name" content=" <?php bloginfo( 'name'); ?>"/>
  1414.  
  1415. <meta property="fb:app_id" content="<?php echo $data['face_AP_ID'];?>"/> <!-- PUT HERE YOUR OWN APP ID - you could get errors if you don't use this one -->
  1416.  
  1417. <meta property="og:description" content=" <?php bloginfo( 'description'); ?>"/>
  1418.  
  1419. <!-- END Facebook OpenGraph Tags -->
  1420.  
  1421. <?php
  1422.  
  1423. }
  1424.  
  1425.  
  1426.  
  1427. ?>
  1428.  
  1429.  
  1430.  
  1431. <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
  1432.  
  1433. <!--[if lt IE 9]>
  1434.  
  1435. <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
  1436.  
  1437. <![endif]-->
  1438.  
  1439.  
  1440.  
  1441. <?php
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447. }
  1448.  
  1449. }
  1450.  
  1451. add_action('wp_head','zn_head');
  1452.  
  1453.  
  1454.  
  1455. /*--------------------------------------------------------------------------------------------------
  1456.  
  1457. ZN PAGE LOADING
  1458.  
  1459. --------------------------------------------------------------------------------------------------*/
  1460.  
  1461. if ( ! function_exists( 'zn_page_loading' ) ) {
  1462.  
  1463. function zn_page_loading() {
  1464.  
  1465. global $data;
  1466.  
  1467. if ( $data['page_preloader'] == 'yes' ) {
  1468.  
  1469.  
  1470.  
  1471. echo '<div id="page-loading"></div>';
  1472.  
  1473.  
  1474.  
  1475. }
  1476.  
  1477. }
  1478.  
  1479. }
  1480.  
  1481.  
  1482.  
  1483. /*--------------------------------------------------------------------------------------------------
  1484.  
  1485. ZN FACEBOOK OPEN GRAPH
  1486.  
  1487. --------------------------------------------------------------------------------------------------*/
  1488.  
  1489. if ( ! function_exists( 'zn_f_o_g' ) ) {
  1490.  
  1491. function zn_f_o_g() {
  1492.  
  1493. global $data;
  1494.  
  1495. if ($data['face_og']) { ?>
  1496.  
  1497. <!-- ADD AN APPLICATION ID !! If you want to know how to find out your
  1498.  
  1499. app id, either search on google for: facebook appid, either go to http://rieglerova.net/how-to-get-a-facebook-app-id/
  1500.  
  1501. -->
  1502.  
  1503. <div id="fb-root"></div>
  1504.  
  1505. <script>
  1506.  
  1507. (function (d, s, id) {
  1508.  
  1509. var js, fjs = d.getElementsByTagName(s)[0];
  1510.  
  1511. if (d.getElementById(id)) return;
  1512.  
  1513. js = d.createElement(s);
  1514.  
  1515. js.id = id;
  1516.  
  1517. js.src = "http://connect.facebook.net/en_US/all.js#xfbml=1&appId=<?php echo $data['face_AP_ID'];?>"; // addyour appId here
  1518.  
  1519. fjs.parentNode.insertBefore(js, fjs);
  1520.  
  1521. }(document, 'script', 'facebook-jssdk'));
  1522.  
  1523. </script>
  1524.  
  1525. <?php }
  1526.  
  1527. }
  1528.  
  1529. }
  1530.  
  1531.  
  1532.  
  1533. $zn_array = array();
  1534.  
  1535.  
  1536.  
  1537. //global $content_and_sidebar;
  1538.  
  1539. $content_and_sidebar = true;
  1540.  
  1541. if ( ! function_exists( 'zn_flag_content_and_sidebar' ) ) {
  1542.  
  1543. function zn_flag_content_and_sidebar() {
  1544.  
  1545. global $content_and_sidebar;
  1546.  
  1547. $content_and_sidebar = false;
  1548.  
  1549. }
  1550.  
  1551. }
  1552.  
  1553.  
  1554.  
  1555. /*--------------------------------------------------------------------------------------------------
  1556.  
  1557. Load the javascript files only if needed
  1558.  
  1559. --------------------------------------------------------------------------------------------------*/
  1560.  
  1561. if ( ! function_exists( 'smart_load' ) ) {
  1562.  
  1563. function smart_load() {
  1564.  
  1565. global $post;
  1566.  
  1567. global $data;
  1568.  
  1569.  
  1570.  
  1571. if ( $post ) {
  1572.  
  1573.  
  1574.  
  1575. $meta_fields = get_post_meta($post->ID, 'zn_meta_elements', true);
  1576.  
  1577. $meta_fields = maybe_unserialize( $meta_fields );
  1578.  
  1579.  
  1580.  
  1581. // All the page builder areas
  1582.  
  1583. $areas = array ( 'header_area' , 'action_box_area' , 'content_main_area', 'content_grey_area' , 'content_bottom_area');
  1584.  
  1585. $metas = array();
  1586.  
  1587.  
  1588.  
  1589. foreach ( $areas as $area ) {
  1590.  
  1591. if ( isset ( $meta_fields[$area] ) ) {
  1592.  
  1593. $metas = array_merge ( $metas , $meta_fields[$area] );
  1594.  
  1595. }
  1596.  
  1597. }
  1598.  
  1599.  
  1600.  
  1601. foreach ($metas as $options )
  1602.  
  1603. {
  1604.  
  1605.  
  1606.  
  1607.  
  1608.  
  1609. // CHECK IF WE HAVE CONTENT AND SIDEBAR
  1610.  
  1611. if ( $options['dynamic_element_type'] == '_content_sidebar' ) {
  1612.  
  1613. zn_flag_content_and_sidebar();
  1614.  
  1615. }
  1616.  
  1617.  
  1618.  
  1619. // Load CSS3 Panels
  1620.  
  1621. if ( $options['dynamic_element_type'] == '_css_pannel' ) {
  1622.  
  1623. wp_enqueue_style( 'css3_panels', get_template_directory_uri() . '/sliders/css3panels/css3panels.css', 'style' );
  1624.  
  1625. wp_enqueue_script('css3_panels', get_template_directory_uri() . '/sliders/css3panels/css3panels.js',array('jquery'),'1.3',true);
  1626.  
  1627. }
  1628.  
  1629.  
  1630.  
  1631. // Load iOS Slider
  1632.  
  1633. if ( $options['dynamic_element_type'] == '_iosSlider' ) {
  1634.  
  1635. wp_enqueue_style('ios_slider', get_template_directory_uri() . '/sliders/iosslider/style.css', 'style');
  1636.  
  1637. //wp_enqueue_style( 'css3_panels');
  1638.  
  1639. wp_enqueue_script('ios_slider_min', get_template_directory_uri() . '/sliders/iosslider/jquery.iosslider.min.js',array('jquery'),'1.3',true);
  1640.  
  1641. wp_enqueue_script('ios_slider_kalypso', get_template_directory_uri() . '/sliders/iosslider/jquery.iosslider.kalypso.js',array('jquery'),'1.3',true);
  1642.  
  1643.  
  1644.  
  1645. $ios_slider = array ( 'zn_ios_slider' =>
  1646.  
  1647. "
  1648.  
  1649. jQuery('.iosSlider').iosSlider({
  1650.  
  1651. snapToChildren: true,
  1652.  
  1653. desktopClickDrag: true,
  1654.  
  1655. keyboardControls: true,
  1656.  
  1657. navNextSelector: jQuery('.next'),
  1658.  
  1659. navPrevSelector: jQuery('.prev'),
  1660.  
  1661. navSlideSelector: jQuery('.selectors .item'),
  1662.  
  1663. scrollbar: true,
  1664.  
  1665. scrollbarContainer: '#slideshow .scrollbarContainer',
  1666.  
  1667. scrollbarMargin: '0',
  1668.  
  1669. scrollbarBorderRadius: '4px',
  1670.  
  1671. onSlideComplete: slideComplete,
  1672.  
  1673. onSliderLoaded: function(args){
  1674.  
  1675. var otherSettings = {
  1676.  
  1677. hideControls : true, // Bool, if true, the NAVIGATION ARROWS will be hidden and shown only on mouseover the slider
  1678.  
  1679. hideCaptions : false // Bool, if true, the CAPTIONS will be hidden and shown only on mouseover the slider
  1680.  
  1681. }
  1682.  
  1683. sliderLoaded(args, otherSettings);
  1684.  
  1685. },
  1686.  
  1687. onSlideChange: slideChange,
  1688.  
  1689. keyboardControls: true,
  1690.  
  1691. infiniteSlider: true,
  1692.  
  1693. autoSlide: true
  1694.  
  1695. });
  1696.  
  1697. ;");
  1698.  
  1699.  
  1700.  
  1701. zn_update_array( $ios_slider );
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707. }
  1708.  
  1709.  
  1710.  
  1711. // Load iCarousel
  1712.  
  1713. if ( $options['dynamic_element_type'] == '_icarousel' ) {
  1714.  
  1715. wp_enqueue_style( 'icarousel_demo', get_template_directory_uri() . '/sliders/icarousel/css/demo3.css', 'style' );
  1716.  
  1717. wp_enqueue_style( 'icarousel', get_template_directory_uri() . '/sliders/icarousel/css/icarousel.css', 'style' );
  1718.  
  1719. wp_enqueue_script('icarousel', get_template_directory_uri() . '/sliders/icarousel/js/icarousel.packed.js',array('jquery'),'1.3',true);
  1720.  
  1721. wp_enqueue_script('mousewheel', get_template_directory_uri() . '/sliders/icarousel/js/jquery.mousewheel.js',array('jquery'),'1.3',true);
  1722.  
  1723. wp_enqueue_script('raphael_min', get_template_directory_uri() . '/sliders/icarousel/js/raphael-min.js',array('jquery'),'1.3',true);
  1724.  
  1725.  
  1726.  
  1727. $icarousel = array ( 'zn_icarousel_slider' =>
  1728.  
  1729. "
  1730.  
  1731. jQuery('#icarousel').iCarousel({
  1732.  
  1733. easing: 'easeInOutQuint',
  1734.  
  1735. slides: 7,
  1736.  
  1737. animationSpeed: 700,
  1738.  
  1739. pauseTime: 5000,
  1740.  
  1741. perspective: 75,
  1742.  
  1743. slidesSpace: 300,
  1744.  
  1745. pauseOnHover: true,
  1746.  
  1747. direction: \"ltr\",
  1748.  
  1749. timer: \"Bar\",
  1750.  
  1751. timerOpacity: 0.4,
  1752.  
  1753. timerDiameter: 220,
  1754.  
  1755. keyboardNav: true,
  1756.  
  1757. mouseWheel: true,
  1758.  
  1759. timerPadding: 3,
  1760.  
  1761. timerStroke: 4,
  1762.  
  1763. timerBarStroke: 0,
  1764.  
  1765. timerColor: \"#FFF\",
  1766.  
  1767. timerPosition: \"bottom-center\",
  1768.  
  1769. timerX: 15,
  1770.  
  1771. timerY: 30
  1772.  
  1773. });
  1774.  
  1775. ;");
  1776.  
  1777.  
  1778.  
  1779. zn_update_array( $icarousel );
  1780.  
  1781.  
  1782.  
  1783. }
  1784.  
  1785.  
  1786.  
  1787. // Load Paralax effect
  1788.  
  1789. if ( $options['dynamic_element_type'] == '_rev_slider' ) {
  1790.  
  1791. if( $options['revslider_paralax'] ){
  1792.  
  1793. wp_enqueue_script('flex_slider', get_template_directory_uri() . '/addons/paralax/parallax.js',array('jquery'),'1.3',true);
  1794.  
  1795. $paralax = array ( 'zn_paralax' =>
  1796.  
  1797. "
  1798.  
  1799. var parallax = new Parallax({
  1800.  
  1801. container: '#slideshow',
  1802.  
  1803. layers: [
  1804.  
  1805. { selector: '.para1', ratio: .020 },
  1806.  
  1807. { selector: '.para2', ratio: .010 },
  1808.  
  1809. { selector: '.para3', ratio: .008 },
  1810.  
  1811. { selector: '.para4', ratio: .005 },
  1812.  
  1813. { selector: '.para5', ratio: .005 }
  1814.  
  1815. ]
  1816.  
  1817. });
  1818.  
  1819.  
  1820.  
  1821. ");
  1822.  
  1823.  
  1824.  
  1825. zn_update_array( $paralax );
  1826.  
  1827.  
  1828.  
  1829. }
  1830.  
  1831.  
  1832.  
  1833. }
  1834.  
  1835.  
  1836.  
  1837. // Load Laptop Slider
  1838.  
  1839. if ( $options['dynamic_element_type'] == '_lslider' ) {
  1840.  
  1841. wp_enqueue_style('lslider', get_template_directory_uri() . '/sliders/flex_slider/css/flexslider-laptop.css', 'style');
  1842.  
  1843. //wp_enqueue_style( 'lslider');
  1844.  
  1845. wp_enqueue_script('flex_slider', get_template_directory_uri() . '/sliders/flex_slider/js/jquery.flexslider-min.js',array('jquery'),'1.3',true);
  1846.  
  1847.  
  1848.  
  1849. $zn_laptop_slider = array ( 'zn_laptop_slider' =>
  1850.  
  1851. "
  1852.  
  1853. (function($){
  1854.  
  1855. $(window).load(function(){
  1856.  
  1857.  
  1858.  
  1859. function slideCompletezn_laptop_slider(args) {
  1860.  
  1861. var caption = $(args.container).find('.flex-caption').attr('style', ''),
  1862.  
  1863. thisCaption = $('.flexslider.zn_laptop_slider .slides > li.flex-active-slide').find('.flex-caption');
  1864.  
  1865. thisCaption.animate({left:20, opacity:1}, 500, 'easeOutQuint');
  1866.  
  1867. }
  1868.  
  1869.  
  1870.  
  1871. $(\".flexslider.zn_laptop_slider\").flexslider({
  1872.  
  1873. animation: \"fade\", //String: Select your animation type, \"fade\" or \"slide\"
  1874.  
  1875. slideDirection: \"horizontal\", //String: Select the sliding direction, \"horizontal\" or \"vertical\"
  1876.  
  1877. slideshow: true, //Boolean: Animate slider automatically
  1878.  
  1879. slideshowSpeed: 997000, //Integer: Set the speed of the slideshow cycling, in milliseconds
  1880.  
  1881. animationDuration: 9600, //Integer: Set the speed of animations, in milliseconds
  1882.  
  1883. directionNav: true, //Boolean: Create navigation for previous/next navigation? (true/false)
  1884.  
  1885. controlNav: false, //Boolean: Create navigation for paging control of each clide? Note: Leave true for manualControls usage
  1886.  
  1887. keyboardNav: true, //Boolean: Allow slider navigating via keyboard left/right keys
  1888.  
  1889. mousewheel: false, //{UPDATED} Boolean: Requires jquery.mousewheel.js (https://github.com/brandonaaron/jquery-mousewheel) - Allows slider navigating via mousewheel
  1890.  
  1891. smoothHeight: false,
  1892.  
  1893. randomize: false, //Boolean: Randomize slide order
  1894.  
  1895. slideToStart: 0, //Integer: The slide that the slider should start on. Array notation (0 = first slide)
  1896.  
  1897. animationLoop: true, //Boolean: Should the animation loop? If false, directionNav will received \"disable\" classes at either end
  1898.  
  1899. pauseOnAction: true, //Boolean: Pause the slideshow when interacting with control elements, highly recommended.
  1900.  
  1901. pauseOnHover: false, //Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering
  1902.  
  1903. start: slideCompletezn_laptop_slider,
  1904.  
  1905. after: slideCompletezn_laptop_slider
  1906.  
  1907. });
  1908.  
  1909. });
  1910.  
  1911. })(jQuery);
  1912.  
  1913. ");
  1914.  
  1915.  
  1916.  
  1917. zn_update_array( $zn_laptop_slider );
  1918.  
  1919.  
  1920.  
  1921.  
  1922.  
  1923. }
  1924.  
  1925.  
  1926.  
  1927. // Load ISOTOPE FOR PORTFOLIO SORTABLE
  1928.  
  1929. if ( $options['dynamic_element_type'] == '_portfolio_sortable' ) {
  1930.  
  1931. wp_enqueue_script('isotope', get_template_directory_uri() . '/js/jquery.isotope.min.js',array('jquery'),'1.4.8',true);
  1932.  
  1933.  
  1934.  
  1935. $zn_isotope = array ( 'zn_isotope' =>
  1936.  
  1937. "
  1938.  
  1939. (function($){
  1940.  
  1941. $(window).load(function(){
  1942.  
  1943.  
  1944.  
  1945. // settings
  1946.  
  1947. var sortBy = 'date', // SORTING: date / name
  1948.  
  1949. sortAscending = true, // SORTING ORDER: true = Ascending / false = Descending
  1950.  
  1951. theFilter = ''; // DEFAULT FILTERING CATEGORY
  1952.  
  1953.  
  1954.  
  1955. $('#sortBy li a').each(function(index, element) {
  1956.  
  1957. var t = $(this);
  1958.  
  1959. if(t.attr('data-option-value') == sortBy)
  1960.  
  1961. t.addClass('selected');
  1962.  
  1963. });
  1964.  
  1965. $('#sort-direction li a').each(function(index, element) {
  1966.  
  1967. var t = $(this);
  1968.  
  1969. if(t.attr('data-option-value') == sortAscending.toString())
  1970.  
  1971. t.addClass('selected');
  1972.  
  1973. });
  1974.  
  1975. $('#portfolio-nav li a').each(function(index, element) {
  1976.  
  1977. var t = $(this),
  1978.  
  1979. tpar = t.parent();
  1980.  
  1981. if(t.attr('data-filter') == theFilter) {
  1982.  
  1983. $('#portfolio-nav li a').parent().removeClass('current');
  1984.  
  1985. tpar.addClass('current');
  1986.  
  1987. }
  1988.  
  1989. });
  1990.  
  1991.  
  1992.  
  1993. // don't edit below unless you know what you're doing
  1994.  
  1995. if ($(\"ul#thumbs\").length > 0){
  1996.  
  1997. var container = $(\"ul#thumbs\");
  1998.  
  1999. container.isotope({
  2000.  
  2001. itemSelector : \".item\",
  2002.  
  2003. animationEngine : \"jquery\",
  2004.  
  2005. animationOptions: {
  2006.  
  2007. duration: 250,
  2008.  
  2009. easing: \"easeOutExpo\",
  2010.  
  2011. queue: false
  2012.  
  2013. },
  2014.  
  2015. filter: theFilter,
  2016.  
  2017. sortAscending : sortAscending,
  2018.  
  2019. getSortData : {
  2020.  
  2021. name : function ( elem ) {
  2022.  
  2023. return elem.find(\"span.name\").text();
  2024.  
  2025. },
  2026.  
  2027. date : function ( elem ) {
  2028.  
  2029. return elem.attr(\"data-date\");
  2030.  
  2031. }
  2032.  
  2033. },
  2034.  
  2035. sortBy: sortBy
  2036.  
  2037. });
  2038.  
  2039.  
  2040.  
  2041. }
  2042.  
  2043. });
  2044.  
  2045. })(jQuery);
  2046.  
  2047. ");
  2048.  
  2049.  
  2050.  
  2051. zn_update_array( $zn_isotope );
  2052.  
  2053.  
  2054.  
  2055. }
  2056.  
  2057.  
  2058.  
  2059.  
  2060.  
  2061. // Load Portfolio Carousel
  2062.  
  2063. if ( $options['dynamic_element_type'] == '_portfolio_carousel' ) {
  2064.  
  2065. wp_enqueue_script('pslider', get_template_directory_uri() . '/sliders/caroufredsel/jquery.carouFredSel-6.0.4-packed.js',array('jquery'),'6.0.4',true);
  2066.  
  2067.  
  2068.  
  2069. $zn_pcarousel = array ( 'zn_pcarousel' =>
  2070.  
  2071. "
  2072.  
  2073. (function($) {
  2074.  
  2075. $(window).load(function(){
  2076.  
  2077. // ** Portfolio Carousel
  2078.  
  2079. var carousels = jQuery('.ptcarousel1');
  2080.  
  2081. carousels.each(function(index, element) {
  2082.  
  2083. $(this).carouFredSel({
  2084.  
  2085. responsive: true,
  2086.  
  2087. items: { width: 570 },
  2088.  
  2089. prev : { button : $(this).parent().find('a.prev'), key : \"left\" },
  2090.  
  2091. next : { button : $(this).parent().find('a.next'), key : \"right\" },
  2092.  
  2093. auto: {timeoutDuration: 5000},
  2094.  
  2095. scroll: { fx: \"crossfade\", duration: \"1500\" }
  2096.  
  2097. });
  2098.  
  2099. });
  2100.  
  2101. // *** end Portfolio Carousel
  2102.  
  2103. });
  2104.  
  2105. })(jQuery);
  2106.  
  2107. ");
  2108.  
  2109.  
  2110.  
  2111. zn_update_array( $zn_pcarousel );
  2112.  
  2113.  
  2114.  
  2115. }
  2116.  
  2117.  
  2118.  
  2119. // Flex Slider
  2120.  
  2121. if ( $options['dynamic_element_type'] == '_flexslider' ) {
  2122.  
  2123. wp_enqueue_style('flex_slider', get_template_directory_uri() . '/sliders/flex_slider/css/flexslider.css', 'style');
  2124.  
  2125. wp_enqueue_style('zn_shadows', get_template_directory_uri() . '/css/shadows.css', 'style');
  2126.  
  2127. wp_enqueue_script('flex_slider', get_template_directory_uri() . '/sliders/flex_slider/js/jquery.flexslider-min.js',array('jquery'),'1.3',true);
  2128.  
  2129.  
  2130.  
  2131. $zn_normal_flex = array ( 'zn_normal_flex' =>
  2132.  
  2133. "
  2134.  
  2135. (function($) {
  2136.  
  2137. $(window).load(function(){
  2138.  
  2139.  
  2140.  
  2141. function slideCompletezn_normal_flex(args) {
  2142.  
  2143. var caption = $(args.container).find('.flex-caption').attr('style', ''),
  2144.  
  2145. thisCaption = $('.flexslider.zn_normal_flex .slides > li.flex-active-slide').find('.flex-caption');
  2146.  
  2147. thisCaption.animate({left:20, opacity:1}, 500, 'easeOutQuint');
  2148.  
  2149. }
  2150.  
  2151.  
  2152.  
  2153. if ( jQuery('.flexslider.zn_normal_flex').hasClass('zn_has_thumbs') ) {
  2154.  
  2155. thumbs = 'thumbnails';
  2156.  
  2157. }
  2158.  
  2159. else {
  2160.  
  2161. thumbs = true;
  2162.  
  2163. }
  2164.  
  2165.  
  2166.  
  2167. transition = jQuery(\".flexslider.zn_normal_flex\").attr('data-transition');
  2168.  
  2169.  
  2170.  
  2171. $(\".flexslider.zn_normal_flex\").flexslider({
  2172.  
  2173. animation: transition, //String: Select your animation type, \"fade\" or \"slide\"
  2174.  
  2175. slideDirection: \"horizontal\", //String: Select the sliding direction, \"horizontal\" or \"vertical\"
  2176.  
  2177. slideshow: true, //Boolean: Animate slider automatically
  2178.  
  2179. slideshowSpeed: 7000, //Integer: Set the speed of the slideshow cycling, in milliseconds
  2180.  
  2181. animationDuration: 600, //Integer: Set the speed of animations, in milliseconds
  2182.  
  2183. directionNav: true, //Boolean: Create navigation for previous/next navigation? (true/false)
  2184.  
  2185. controlNav: thumbs, //Boolean: Create navigation for paging control of each clide? Note: Leave true for manualControls usage
  2186.  
  2187. keyboardNav: true, //Boolean: Allow slider navigating via keyboard left/right keys
  2188.  
  2189. mousewheel: false, //{UPDATED} Boolean: Requires jquery.mousewheel.js (https://github.com/brandonaaron/jquery-mousewheel) - Allows slider navigating via mousewheel
  2190.  
  2191. smoothHeight: true,
  2192.  
  2193. randomize: false, //Boolean: Randomize slide order
  2194.  
  2195. slideToStart: 0, //Integer: The slide that the slider should start on. Array notation (0 = first slide)
  2196.  
  2197. animationLoop: true, //Boolean: Should the animation loop? If false, directionNav will received \"disable\" classes at either end
  2198.  
  2199. pauseOnAction: true, //Boolean: Pause the slideshow when interacting with control elements, highly recommended.
  2200.  
  2201. pauseOnHover: false, //Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering
  2202.  
  2203. start: slideCompletezn_normal_flex,
  2204.  
  2205. after: slideCompletezn_normal_flex
  2206.  
  2207. });
  2208.  
  2209. });
  2210.  
  2211. })(jQuery);
  2212.  
  2213. ");
  2214.  
  2215.  
  2216.  
  2217. zn_update_array( $zn_normal_flex );
  2218.  
  2219.  
  2220.  
  2221. }
  2222.  
  2223.  
  2224.  
  2225. // Fancy Slider
  2226.  
  2227. if ( $options['dynamic_element_type'] == '_fancyslider' ) {
  2228.  
  2229. wp_enqueue_style('flex_slider_fancy', get_template_directory_uri() . '/sliders/flex_slider/css/flexslider-fancy.css', 'style');
  2230.  
  2231. wp_enqueue_script('flex_slider', get_template_directory_uri() . '/sliders/flex_slider/js/jquery.flexslider-min.js',array('jquery'),'1.3',true);
  2232.  
  2233. wp_enqueue_script('flex_slider_colors', get_template_directory_uri() . '/sliders/flex_slider/js/jquery.animate-colors-min.js',array('jquery'),'1.3',true);
  2234.  
  2235.  
  2236.  
  2237. $zn_fancy_slider = array ( 'zn_fancy_slider' =>
  2238.  
  2239. "
  2240.  
  2241. (function($) {
  2242.  
  2243. $(window).load(function(){
  2244.  
  2245. function slideCompleteFancy(args) {
  2246.  
  2247. //console.log(args);
  2248.  
  2249. var _arg = $(args),
  2250.  
  2251. slideshow = _arg.closest('#slideshow'),
  2252.  
  2253. color = $(args.slides).eq(args.animatingTo).attr('data-color');
  2254.  
  2255. console.log(color)
  2256.  
  2257. if( _arg.css('background-image') != 'none') _arg.css('background-image', 'none');
  2258.  
  2259.  
  2260.  
  2261. slideshow.animate({backgroundColor: color}, 400);
  2262.  
  2263. //slideshow.css({'background-color': color});
  2264.  
  2265. }
  2266.  
  2267.  
  2268.  
  2269. $(\".flexslider.zn_fancy_slider\").flexslider({
  2270.  
  2271. animation: \"slide\", //String: Select your animation type, \"fade\" or \"slide\"
  2272.  
  2273. direction: \"vertical\", //String: Select the sliding direction, \"horizontal\" or \"vertical\"
  2274.  
  2275. slideshow: true, //Boolean: Animate slider automatically
  2276.  
  2277. slideshowSpeed: 7000, //Integer: Set the speed of the slideshow cycling, in milliseconds
  2278.  
  2279. animationDuration: 600, //Integer: Set the speed of animations, in milliseconds
  2280.  
  2281. directionNav: true, //Boolean: Create navigation for previous/next navigation? (true/false)
  2282.  
  2283. controlNav: true, //Boolean: Create navigation for paging control of each clide? Note: Leave true for manualControls usage
  2284.  
  2285. keyboardNav: true, //Boolean: Allow slider navigating via keyboard left/right keys
  2286.  
  2287. mousewheel: false, //{UPDATED} Boolean: Requires jquery.mousewheel.js (https://github.com/brandonaaron/jquery-mousewheel) - Allows slider navigating via mousewheel
  2288.  
  2289. smoothHeight: true,
  2290.  
  2291. randomize: false, //Boolean: Randomize slide order
  2292.  
  2293. slideToStart: 0, //Integer: The slide that the slider should start on. Array notation (0 = first slide)
  2294.  
  2295. animationLoop: true, //Boolean: Should the animation loop? If false, directionNav will received \"disable\" classes at either end
  2296.  
  2297. pauseOnAction: true, //Boolean: Pause the slideshow when interacting with control elements, highly recommended.
  2298.  
  2299. pauseOnHover: false, //Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering
  2300.  
  2301. start: slideCompleteFancy,
  2302.  
  2303. before: slideCompleteFancy
  2304.  
  2305. });
  2306.  
  2307. });
  2308.  
  2309. })(jQuery);
  2310.  
  2311. ");
  2312.  
  2313.  
  2314.  
  2315. zn_update_array( $zn_fancy_slider );
  2316.  
  2317.  
  2318.  
  2319. }
  2320.  
  2321.  
  2322.  
  2323. // Carousel Slider ( CIRCULAR CONTENT )
  2324.  
  2325. if ( $options['dynamic_element_type'] == '_circ1' || $options['dynamic_element_type'] == '_circ2' ) {
  2326.  
  2327. wp_enqueue_style('circular_carousel', get_template_directory_uri() . '/sliders/circular_content_carousel/css/circular_content_carousel.css', 'style');
  2328.  
  2329.  
  2330.  
  2331. if ( $options['dynamic_element_type'] == '_circ2' ) {
  2332.  
  2333.  
  2334.  
  2335. wp_enqueue_style('circular_carousel_alternative', get_template_directory_uri() . '/sliders/circular_content_carousel/css/circular_content_carousel_alternative.css', 'style');
  2336.  
  2337.  
  2338.  
  2339. }
  2340.  
  2341.  
  2342.  
  2343. wp_enqueue_script('mousewheel', get_template_directory_uri() . '/sliders/circular_content_carousel/js/jquery.mousewheel.js',array('jquery'),'1.3',true);
  2344.  
  2345. wp_enqueue_script('swipe', get_template_directory_uri() . '/sliders/circular_content_carousel/js/jquery.swipe.js',array('jquery'),'1.3',true);
  2346.  
  2347. wp_enqueue_script('contentcarousel', get_template_directory_uri() . '/sliders/circular_content_carousel/js/jquery.contentcarousel.js',array('jquery'),'1.3',true);
  2348.  
  2349.  
  2350.  
  2351.  
  2352.  
  2353. $contentcarousel = array ( 'zn_contentcarousel' =>
  2354.  
  2355. "
  2356.  
  2357. jQuery('#ca-container').contentcarousel();
  2358.  
  2359.  
  2360.  
  2361. setTimeout(function() {
  2362.  
  2363. jQuery('#ca-container .ca-icon').css('backgroundImage', 'none');
  2364.  
  2365. }, 1000);
  2366.  
  2367. ;");
  2368.  
  2369.  
  2370.  
  2371. zn_update_array( $contentcarousel );
  2372.  
  2373.  
  2374.  
  2375.  
  2376.  
  2377. }
  2378.  
  2379.  
  2380.  
  2381. // Nivo Slider
  2382.  
  2383. if ( $options['dynamic_element_type'] == '_nivoslider' ) {
  2384.  
  2385. wp_enqueue_style('nivo_slider', get_template_directory_uri() . '/sliders/nivo_slider/css/nivo-slider.css', 'style');
  2386.  
  2387. wp_enqueue_style('zn_shadows', get_template_directory_uri() . '/css/shadows.css', 'style');
  2388.  
  2389. wp_enqueue_script('nivo_slider', get_template_directory_uri() . '/sliders/nivo_slider/js/jquery.nivo.slider.pack.js',array('jquery'),'1.3',true);
  2390.  
  2391.  
  2392.  
  2393. $zn_nivo_slider = array ( 'zn_nivo_slider' =>
  2394.  
  2395. "
  2396.  
  2397. (function($) {
  2398.  
  2399. $(window).load(function(){
  2400.  
  2401. var slider = $('#nivoslider .nivoSlider');
  2402.  
  2403.  
  2404.  
  2405. function slideFirst() {
  2406.  
  2407. var caption = slider.find('.nivo-caption');
  2408.  
  2409. setTimeout(function(){
  2410.  
  2411. caption.css('min-width',400).animate({left:20, opacity:1}, 500, 'easeOutQuint');
  2412.  
  2413. }, 1000);
  2414.  
  2415. }
  2416.  
  2417. function slideIn() {
  2418.  
  2419. slider.find('.nivo-caption').css('min-width','').animate({left:20, opacity:1}, 500, 'easeOutQuint');
  2420.  
  2421. }
  2422.  
  2423. function slideOut() {
  2424.  
  2425. slider.find('.nivo-caption').css('min-width','').animate({left:120, opacity:0}, 500, 'easeOutQuint');
  2426.  
  2427. }
  2428.  
  2429.  
  2430.  
  2431. transition = slider.attr('data-transition');
  2432.  
  2433.  
  2434.  
  2435.  
  2436.  
  2437. slider.nivoSlider({
  2438.  
  2439. effect:transition, // Specify sets like: 'fold,fade,sliceDown'
  2440.  
  2441. boxCols: 8, // For box animations
  2442.  
  2443. boxRows: 4, // For box animations
  2444.  
  2445. slices:15, // For slice animations
  2446.  
  2447. animSpeed:500, // Slide transition speed
  2448.  
  2449. pauseTime:3000, // How long each slide will show
  2450.  
  2451. startSlide:0, // Set starting Slide (0 index)
  2452.  
  2453. directionNav:1, // Next & Prev navigation
  2454.  
  2455. controlNav:1, // 1,2,3... navigation
  2456.  
  2457. controlNavThumbs:0, // Use thumbnails for Control Nav
  2458.  
  2459. pauseOnHover:1, // Stop animation while hovering
  2460.  
  2461. manualAdvance:1, // Force manual transitions
  2462.  
  2463. afterLoad: slideFirst,
  2464.  
  2465. beforeChange: slideOut,
  2466.  
  2467. afterChange: slideIn
  2468.  
  2469. });
  2470.  
  2471. });
  2472.  
  2473. })(jQuery);
  2474.  
  2475. ");
  2476.  
  2477.  
  2478.  
  2479. zn_update_array( $zn_nivo_slider );
  2480.  
  2481.  
  2482.  
  2483. }
  2484.  
  2485.  
  2486.  
  2487. // Wow Slider
  2488.  
  2489. if ( $options['dynamic_element_type'] == '_wowslider' ) {
  2490.  
  2491. wp_enqueue_style('wow_slider', get_template_directory_uri() . '/sliders/wow_slider/css/style.css', 'style');
  2492.  
  2493. wp_enqueue_style('zn_shadows', get_template_directory_uri() . '/css/shadows.css', 'style');
  2494.  
  2495. wp_enqueue_script('wow_slider', get_template_directory_uri() . '/sliders/wow_slider/js/wowslider.js',array('jquery'),'1.3',true);
  2496.  
  2497. wp_enqueue_script('wow_slider_'.$options['ww_transition'].'', get_template_directory_uri() . '/sliders/wow_slider/js/'.$options['ww_transition'].'.js',array('jquery','wow_slider'),'1.3',true);
  2498.  
  2499.  
  2500.  
  2501. $zn_wow_slider = array ( 'zn_wow_slider' =>
  2502.  
  2503. "
  2504.  
  2505. (function($) {
  2506.  
  2507. $(window).load(function(){
  2508.  
  2509. transition = jQuery(\"#wowslider-container\").attr('data-transition');
  2510.  
  2511.  
  2512.  
  2513. jQuery(\"#wowslider-container\").wowSlider({
  2514.  
  2515. effect:transition,
  2516.  
  2517. duration:900,
  2518.  
  2519. delay:2000,
  2520.  
  2521. width:1170,
  2522.  
  2523. height:465,
  2524.  
  2525. cols:6,
  2526.  
  2527. autoPlay:true,
  2528.  
  2529. stopOnHover:true,
  2530.  
  2531. loop:true,
  2532.  
  2533. bullets:true,
  2534.  
  2535. caption:true,
  2536.  
  2537. controls:true,
  2538.  
  2539. captionEffect:\"slide\",
  2540.  
  2541. logo:\"image/loading_light.gif\",
  2542.  
  2543. images:0
  2544.  
  2545. });
  2546.  
  2547. });
  2548.  
  2549. })(jQuery);
  2550.  
  2551. ");
  2552.  
  2553.  
  2554.  
  2555. zn_update_array( $zn_wow_slider );
  2556.  
  2557.  
  2558.  
  2559. }
  2560.  
  2561.  
  2562.  
  2563. // Product Loupe
  2564.  
  2565. if ( $options['dynamic_element_type'] == '_static6' ) {
  2566.  
  2567. wp_enqueue_script('zn_product_loupe', get_template_directory_uri() . '/addons/jquery_loupe/jquery.loupe.min.js',array('jquery'),'1.3',true);
  2568.  
  2569. }
  2570.  
  2571.  
  2572.  
  2573. // Testimonials slider
  2574.  
  2575. if ( $options['dynamic_element_type'] == '_testimonial_slider' ) {
  2576.  
  2577. wp_enqueue_script('pslider', get_template_directory_uri() . '/sliders/caroufredsel/jquery.carouFredSel-6.0.4-packed.js',array('jquery'),'6.0.4',true);
  2578.  
  2579.  
  2580.  
  2581. $speed = 'auto: {timeoutDuration: 5000},';
  2582.  
  2583. if ( !empty($options['tf_speed']) ) { $speed = 'auto:{timeoutDuration:'.$options['tf_speed'].'},'; }
  2584.  
  2585.  
  2586.  
  2587.  
  2588.  
  2589. $testimonial_slider = array ( 'zn_testimonial_slider' =>
  2590.  
  2591. "
  2592.  
  2593. // ** Testimonials fader
  2594.  
  2595. jQuery('#testimonials_fader').carouFredSel({
  2596.  
  2597. responsive:true,
  2598.  
  2599. ".$speed."
  2600.  
  2601. scroll: { fx: \"fade\", duration: \"1500\" }
  2602.  
  2603. });
  2604.  
  2605. // *** end testimonials fader
  2606.  
  2607. ;");
  2608.  
  2609.  
  2610.  
  2611. zn_update_array( $testimonial_slider );
  2612.  
  2613. }
  2614.  
  2615.  
  2616.  
  2617. // Products box
  2618.  
  2619. if ( $options['dynamic_element_type'] == '_woo_products' ) {
  2620.  
  2621. wp_enqueue_script('pslider', get_template_directory_uri() . '/sliders/caroufredsel/jquery.carouFredSel-6.0.4-packed.js',array('jquery'),'6.0.4',true);
  2622.  
  2623.  
  2624.  
  2625. $woo_products = array ( 'woo_products' =>
  2626.  
  2627. "
  2628.  
  2629. (function($){
  2630.  
  2631. $(window).load(function() {
  2632.  
  2633. // latest & bestsellers carousels
  2634.  
  2635. jQuery('.shop-latest-carousel > ul').each(function(index, element) {
  2636.  
  2637. jQuery(this).carouFredSel({
  2638.  
  2639. responsive: true,
  2640.  
  2641. scroll: 1,
  2642.  
  2643. auto: false,
  2644.  
  2645. items: {width:300, visible: { min: 1, max: 4 } },
  2646.  
  2647. prev : { button : jQuery(this).parent().find('a.prev'), key : \"left\" },
  2648.  
  2649. next : { button : jQuery(this).parent().find('a.next'), key : \"right\" },
  2650.  
  2651. });
  2652.  
  2653. });
  2654.  
  2655. });
  2656.  
  2657. })(jQuery);
  2658.  
  2659. ");
  2660.  
  2661.  
  2662.  
  2663. zn_update_array( $woo_products );
  2664.  
  2665. }
  2666.  
  2667.  
  2668.  
  2669. // Products Offers
  2670.  
  2671. if ( $options['dynamic_element_type'] == '_woo_limited' ) {
  2672.  
  2673. wp_enqueue_script('pslider', get_template_directory_uri() . '/sliders/caroufredsel/jquery.carouFredSel-6.0.4-packed.js',array('jquery'),'6.0.4',true);
  2674.  
  2675.  
  2676.  
  2677. $woo_offers = array ( 'woo_offers' =>
  2678.  
  2679. "
  2680.  
  2681. (function($){
  2682.  
  2683. $(window).load(function() {
  2684.  
  2685. // latest & bestsellers carousels
  2686.  
  2687. jQuery('#limited_offers').carouFredSel({
  2688.  
  2689. responsive: true,
  2690.  
  2691. width: '92%',
  2692.  
  2693. scroll: 1,
  2694.  
  2695. /*auto: true,*/
  2696.  
  2697. items: {width:190, visible: { min: 2, max: 4 } },
  2698.  
  2699. prev : { button : jQuery('.limited-offers-carousel .prev'), key : \"left\" },
  2700.  
  2701. next : { button : jQuery('.limited-offers-carousel .next'), key : \"right\" },
  2702.  
  2703. });
  2704.  
  2705. });
  2706.  
  2707. })(jQuery);
  2708.  
  2709. ");
  2710.  
  2711.  
  2712.  
  2713. zn_update_array( $woo_offers );
  2714.  
  2715. }
  2716.  
  2717.  
  2718.  
  2719. // CONTACT FORM
  2720.  
  2721. if ( $options['dynamic_element_type'] == '_c_form' ) {
  2722.  
  2723.  
  2724.  
  2725. $contact_form = array ( 'zn_testimonial_slider' =>
  2726.  
  2727. "
  2728.  
  2729. (function($){
  2730.  
  2731. $(document).ready(function() {
  2732.  
  2733. $('#submit-form').click(function(e){
  2734.  
  2735.  
  2736.  
  2737. var form = $(this).closest('.zn_form');
  2738.  
  2739. var success = $('#success',form);
  2740.  
  2741. var has_error = false;
  2742.  
  2743.  
  2744.  
  2745. e.preventDefault();
  2746.  
  2747. var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
  2748.  
  2749.  
  2750.  
  2751. $('input.zn_required_field, textarea.zn_required_field',form).each(function(){
  2752.  
  2753.  
  2754.  
  2755. if ( $(this).val().length == 0 ) {
  2756.  
  2757. $(this).closest('.control-group').addClass('error');
  2758.  
  2759. has_error = true;
  2760.  
  2761. }
  2762.  
  2763.  
  2764.  
  2765. else if( $(this).hasClass( 'zn_email_field' ) && reg.test($(this).val()) == false ) {
  2766.  
  2767.  
  2768.  
  2769. $(this).closest('.control-group').addClass('error');
  2770.  
  2771.  
  2772.  
  2773. has_error = true;
  2774.  
  2775. }
  2776.  
  2777. else {
  2778.  
  2779. $(this).closest('.control-group').removeClass('error');
  2780.  
  2781. }
  2782.  
  2783.  
  2784.  
  2785. });
  2786.  
  2787.  
  2788.  
  2789. if (has_error) {
  2790.  
  2791. return false;
  2792.  
  2793. }
  2794.  
  2795.  
  2796.  
  2797. $.ajax({
  2798.  
  2799. type: 'POST',
  2800.  
  2801. url: location.href,
  2802.  
  2803. data: $(form).serialize(),
  2804.  
  2805. success: function(msg){
  2806.  
  2807.  
  2808.  
  2809. if (msg == 'sent'){
  2810.  
  2811. window.location = 'http://www.cbconlin.com/contact-us/thank-you/';
  2812.  
  2813. //success.html('<div class=\"alert alert-success\">".__('Message successfully sent!',THEMENAME)."</div>') ;
  2814.  
  2815. //$('input:not(#submit-form), textarea',form).val('')
  2816.  
  2817.  
  2818.  
  2819. }else{
  2820.  
  2821. success.html('<div class=\"alert alert-error\">".__('Message not sent! Please Try Again!',THEMENAME)."</div>') ;
  2822.  
  2823. }
  2824.  
  2825. }
  2826.  
  2827. });
  2828.  
  2829.  
  2830.  
  2831.  
  2832.  
  2833.  
  2834.  
  2835. });
  2836.  
  2837. });
  2838.  
  2839. })(jQuery);
  2840.  
  2841. ");
  2842.  
  2843.  
  2844.  
  2845. zn_update_array( $contact_form );
  2846.  
  2847. }
  2848.  
  2849.  
  2850.  
  2851. // Testimonials slider 2
  2852.  
  2853. if ( $options['dynamic_element_type'] == '_testimonial_slider2' ) {
  2854.  
  2855. wp_enqueue_script('pslider', get_template_directory_uri() . '/sliders/caroufredsel/jquery.carouFredSel-6.0.4-packed.js',array('jquery'),'6.0.4',true);
  2856.  
  2857.  
  2858.  
  2859. $speed = 'auto: true,';
  2860.  
  2861. if ( !empty($options['tf_speed']) ) { $speed = 'auto:{timeoutDuration:'.$options['tf_speed'].'},'; }
  2862.  
  2863.  
  2864.  
  2865. $testimonial_slider2 = array ( 'zn_testimonial_slider2' =>
  2866.  
  2867. "
  2868.  
  2869. jQuery(window).load(function() {
  2870.  
  2871. // ** Testimonials carousel
  2872.  
  2873. jQuery('.zn_testimonials_carousel').carouFredSel({
  2874.  
  2875. responsive: true,
  2876.  
  2877.  
  2878.  
  2879. items: {
  2880.  
  2881. width: 300
  2882.  
  2883. },
  2884.  
  2885. ".$speed."
  2886.  
  2887.  
  2888.  
  2889. prev : {
  2890.  
  2891. button : function(){return jQuery(this).closest('.testimonials-carousel').find('.prev');},
  2892.  
  2893. key : \"left\"
  2894.  
  2895. },
  2896.  
  2897. next : {
  2898.  
  2899. button : function(){return jQuery(this).closest('.testimonials-carousel').find('.next');},
  2900.  
  2901. key : \"right\"
  2902.  
  2903. }
  2904.  
  2905. });
  2906.  
  2907. // *** end testimonials carousel
  2908.  
  2909. });
  2910.  
  2911. ");
  2912.  
  2913.  
  2914.  
  2915. zn_update_array( $testimonial_slider2 );
  2916.  
  2917. }
  2918.  
  2919.  
  2920.  
  2921. // SCREENSHOOT BOX
  2922.  
  2923. if ( $options['dynamic_element_type'] == '_screenshoot_box' ) {
  2924.  
  2925. wp_enqueue_script('pslider', get_template_directory_uri() . '/sliders/caroufredsel/jquery.carouFredSel-6.0.4-packed.js',array('jquery'),'6.0.4',true);
  2926.  
  2927.  
  2928.  
  2929. $screenshoot_box = array ( 'zn_screenshoot_box' =>
  2930.  
  2931. "jQuery(window).load(function() {
  2932.  
  2933. // ** Screenshots carousel
  2934.  
  2935. jQuery('#screenshot-carousel').carouFredSel({
  2936.  
  2937. responsive: true,
  2938.  
  2939. scroll: { fx: \"crossfade\", duration: \"1500\" },
  2940.  
  2941. items: {
  2942.  
  2943. width: 580
  2944.  
  2945. },
  2946.  
  2947. auto: true,
  2948.  
  2949. prev : {
  2950.  
  2951. button : \".thescreenshot .prev\",
  2952.  
  2953. key : \"left\"
  2954.  
  2955. },
  2956.  
  2957. next : {
  2958.  
  2959. button : \".thescreenshot .next\",
  2960.  
  2961. key : \"right\"
  2962.  
  2963. }
  2964.  
  2965. });
  2966.  
  2967. // *** end Screenshots carousel
  2968.  
  2969.  
  2970.  
  2971. });");
  2972.  
  2973.  
  2974.  
  2975. zn_update_array( $screenshoot_box );
  2976.  
  2977.  
  2978.  
  2979. }
  2980.  
  2981.  
  2982.  
  2983. // FLICKR FEED
  2984.  
  2985. if ( $options['dynamic_element_type'] == '_flickrfeed' ) {
  2986.  
  2987. wp_enqueue_script('flickr_feed', get_template_directory_uri() . '/addons/flickrfeed/jquery.jflickrfeed.min.js',array('jquery'),'6.0.4',true);
  2988.  
  2989.  
  2990.  
  2991. if ( !empty ( $options['ff_id'] ) ) {
  2992.  
  2993.  
  2994.  
  2995. $flickr = array ( 'zn_flickr_feed' =>
  2996.  
  2997. "
  2998.  
  2999. (function($){
  3000.  
  3001. jQuery(window).load(function() {
  3002.  
  3003. // load flicker photos
  3004.  
  3005.  
  3006.  
  3007. var ff_container = jQuery('.flickr_feeds'),
  3008.  
  3009. ff_limit = (ff_container.attr('data-limit')) ? ff_container.attr('data-limit') : 6;
  3010.  
  3011.  
  3012.  
  3013. ff_container.parent().removeClass('loading');
  3014.  
  3015. // ff_limit = if data-limit attribute is set, the limit is user defined, if not, default is 6
  3016.  
  3017.  
  3018.  
  3019. ff_container.jflickrfeed({
  3020.  
  3021. limit: ff_limit,
  3022.  
  3023. qstrings: {
  3024.  
  3025. id: '".$options['ff_id']."'
  3026.  
  3027. },
  3028.  
  3029. itemTemplate: '<li><a href=\"{{image_b}}\" data-rel=\"prettyPhoto\"><img src=\"{{image_s}}\" alt=\"{{title}}\" /><span class=\"theHoverBorder \"></span></a></li>'
  3030.  
  3031. }, function(data) {
  3032.  
  3033. jQuery(\".flickr_feeds a[data-rel^='prettyPhoto']\").prettyPhoto({theme:'pp_kalypso',social_tools:false, deeplinking:false});
  3034.  
  3035. //jQuery(\".flickr_feeds li:nth-child(3n)\").addClass(\"last\");
  3036.  
  3037. });
  3038.  
  3039.  
  3040.  
  3041. });
  3042.  
  3043. })(jQuery);
  3044.  
  3045. ");
  3046.  
  3047.  
  3048.  
  3049. zn_update_array( $flickr );
  3050.  
  3051.  
  3052.  
  3053. }
  3054.  
  3055. }
  3056.  
  3057.  
  3058.  
  3059. // Partners logos
  3060.  
  3061. if ( $options['dynamic_element_type'] == '_partners_logos' ) {
  3062.  
  3063. wp_enqueue_script('pslider', get_template_directory_uri() . '/sliders/caroufredsel/jquery.carouFredSel-6.0.4-packed.js',array('jquery'),'6.0.4',true);
  3064.  
  3065.  
  3066.  
  3067. $partners_logos = array ( 'zn_partners_logo' =>
  3068.  
  3069. "jQuery(window).load(function(){
  3070.  
  3071. // ** partners carousel
  3072.  
  3073. jQuery('#partners_carousel').carouFredSel({
  3074.  
  3075. responsive: true,
  3076.  
  3077. scroll: 1,
  3078.  
  3079. auto: false,
  3080.  
  3081. items: {
  3082.  
  3083. width: 250,
  3084.  
  3085. visible: {
  3086.  
  3087. min: 3,
  3088.  
  3089. max: 10
  3090.  
  3091. }
  3092.  
  3093. },
  3094.  
  3095. prev : {
  3096.  
  3097. button : \".partners_carousel .prev\",
  3098.  
  3099. key : \"left\"
  3100.  
  3101. },
  3102.  
  3103. next : {
  3104.  
  3105. button : \".partners_carousel .next\",
  3106.  
  3107. key : \"right\"
  3108.  
  3109. }
  3110.  
  3111. });
  3112.  
  3113. // *** end partners carousel
  3114.  
  3115. });");
  3116.  
  3117.  
  3118.  
  3119. zn_update_array( $partners_logos );
  3120.  
  3121. }
  3122.  
  3123.  
  3124.  
  3125. // Recent Works
  3126.  
  3127. if ( $options['dynamic_element_type'] == '_recent_work' ) {
  3128.  
  3129. wp_enqueue_script('pslider', get_template_directory_uri() . '/sliders/caroufredsel/jquery.carouFredSel-6.0.4-packed.js',array('jquery'),'6.0.4',true);
  3130.  
  3131.  
  3132.  
  3133. $zn_recent_works = array ( 'zn_recent_works' =>
  3134.  
  3135. "jQuery(window).load(function(){
  3136.  
  3137. // ** recent works
  3138.  
  3139. jQuery('.recent_works1').carouFredSel({
  3140.  
  3141. responsive: true,
  3142.  
  3143. scroll: 1,
  3144.  
  3145. auto: false,
  3146.  
  3147. items: {
  3148.  
  3149. width: 300,
  3150.  
  3151. visible: {
  3152.  
  3153. min: 3,
  3154.  
  3155. max: 10
  3156.  
  3157. }
  3158.  
  3159. },
  3160.  
  3161. prev : {
  3162.  
  3163. button : function(){return jQuery(this).closest('.recentwork_carousel').find('.prev');},
  3164.  
  3165. key : \"left\"
  3166.  
  3167. },
  3168.  
  3169. next : {
  3170.  
  3171. button : function(){return jQuery(this).closest('.recentwork_carousel').find('.next');},
  3172.  
  3173. key : \"right\"
  3174.  
  3175. }
  3176.  
  3177. });
  3178.  
  3179. // *** end recent works carousel
  3180.  
  3181. });");
  3182.  
  3183.  
  3184.  
  3185. zn_update_array( $zn_recent_works );
  3186.  
  3187.  
  3188.  
  3189. }
  3190.  
  3191.  
  3192.  
  3193. // Recent Works
  3194.  
  3195. if ( $options['dynamic_element_type'] == '_recent_work2' ) {
  3196.  
  3197. wp_enqueue_script('pslider', get_template_directory_uri() . '/sliders/caroufredsel/jquery.carouFredSel-6.0.4-packed.js',array('jquery'),'6.0.4',true);
  3198.  
  3199.  
  3200.  
  3201. $zn_recent_works2 = array ( 'zn_recent_works2' =>
  3202.  
  3203. "
  3204.  
  3205. jQuery(window).load(function(){
  3206.  
  3207. jQuery('.recent_works2').carouFredSel({
  3208.  
  3209. responsive: true,
  3210.  
  3211. scroll: 1,
  3212.  
  3213. auto: false,
  3214.  
  3215. items: {
  3216.  
  3217. width: 400,
  3218.  
  3219. visible: {
  3220.  
  3221. min: 4,
  3222.  
  3223. max: 10
  3224.  
  3225. }
  3226.  
  3227. },
  3228.  
  3229. prev : {
  3230.  
  3231. button : function(){return jQuery(this).closest('.recentwork_carousel').find('.prev');},
  3232.  
  3233. key : \"left\"
  3234.  
  3235. },
  3236.  
  3237. next : {
  3238.  
  3239. button : function(){return jQuery(this).closest('.recentwork_carousel').find('.next');},
  3240.  
  3241. key : \"right\"
  3242.  
  3243. }
  3244.  
  3245. });
  3246.  
  3247. });
  3248.  
  3249. // *** end recent works carousel");
  3250.  
  3251.  
  3252.  
  3253. zn_update_array( $zn_recent_works2 );
  3254.  
  3255.  
  3256.  
  3257. }
  3258.  
  3259.  
  3260.  
  3261. // ACCORDION ELEMENT
  3262.  
  3263. if ( $options['dynamic_element_type'] == '_static7' ) {
  3264.  
  3265.  
  3266.  
  3267. }
  3268.  
  3269.  
  3270.  
  3271. // Event Countdown
  3272.  
  3273. if ( $options['dynamic_element_type'] == '_static7' ) {
  3274.  
  3275. wp_enqueue_script('zn_event_countdown', get_template_directory_uri() . '/js/jquery.countdown.js',array('jquery'),'1.3',true);
  3276.  
  3277.  
  3278.  
  3279.  
  3280.  
  3281. $zn_event_countdown = array ( 'zn_event_countdown' =>
  3282.  
  3283. "
  3284.  
  3285. var counter = {
  3286.  
  3287. init: function (d)
  3288.  
  3289. {
  3290.  
  3291. jQuery('#Counter').countdown({
  3292.  
  3293. until: new Date(d),
  3294.  
  3295. layout: counter.layout(),
  3296.  
  3297. labels: ['".__('years',THEMENAME)."', '".__('months',THEMENAME)."', '".__('weeks',THEMENAME)."', '".__('days',THEMENAME)."', '".__('hours',THEMENAME)."', '".__('min',THEMENAME)."', '".__('sec',THEMENAME)."'],
  3298.  
  3299. labels1: ['".__('year',THEMENAME)."', '".__('month',THEMENAME)."', '".__('week',THEMENAME)."', '".__('day',THEMENAME)."', '".__('hour',THEMENAME)."', '".__('min',THEMENAME)."', '".__('sec',THEMENAME)."']
  3300.  
  3301. });
  3302.  
  3303. },
  3304.  
  3305. layout: function ()
  3306.  
  3307. {
  3308.  
  3309. return '<li>{dn}<span>{dl}</span></li>' +
  3310.  
  3311. '<li>{hnn}<span>{hl}</span></li>' +
  3312.  
  3313. '<li>{mnn}<span>{ml}</span></li>' +
  3314.  
  3315. '<li>{snn}<span>{sl}</span></li>';
  3316.  
  3317. }
  3318.  
  3319. }
  3320.  
  3321.  
  3322.  
  3323. // initialize the counter
  3324.  
  3325. counter.init(\"".$options['sc_ec_date']['date']." ".$options['sc_ec_date']['time']."\");
  3326.  
  3327. ");
  3328.  
  3329.  
  3330.  
  3331. zn_update_array( $zn_event_countdown );
  3332.  
  3333. }
  3334.  
  3335.  
  3336.  
  3337. // Load Mailchimp JS only if used by widget or event countdown
  3338.  
  3339. if ( is_active_widget( false, false, 'zn_mailchimp', true ) || $options['dynamic_element_type'] == '_static7' ) {
  3340.  
  3341. $zn_mailchimp = array ( 'zn_mailchimp' =>
  3342.  
  3343. "// PREPARE THE NEWSLETTER AND SEND DATA TO MAILCHIMP
  3344.  
  3345. jQuery('.nl-submit').click(function() {
  3346.  
  3347.  
  3348.  
  3349. ajax_url = jQuery(this).parent().attr('data-url');
  3350.  
  3351. result_placeholder = jQuery(this).parent().next('span.zn_mailchimp_result');
  3352.  
  3353.  
  3354.  
  3355.  
  3356.  
  3357. jQuery.ajax({
  3358.  
  3359. url: ajax_url,
  3360.  
  3361. type: 'POST',
  3362.  
  3363. data: {
  3364.  
  3365. zn_mc_email: jQuery(this).prevAll('.nl-email').val(),
  3366.  
  3367. zn_mailchimp_list: jQuery(this).prev('.nl-lid').val(),
  3368.  
  3369. zn_ajax: '' // Change here with something different
  3370.  
  3371. },
  3372.  
  3373. success: function(data){
  3374.  
  3375. result_placeholder.html(data);
  3376.  
  3377.  
  3378.  
  3379. },
  3380.  
  3381. error: function() {
  3382.  
  3383. result_placeholder.html('ERROR.').css('color', 'red');
  3384.  
  3385. }
  3386.  
  3387. });
  3388.  
  3389. return false;
  3390.  
  3391. });
  3392.  
  3393. ");
  3394.  
  3395.  
  3396.  
  3397. zn_update_array( $zn_mailchimp );
  3398.  
  3399.  
  3400.  
  3401. }
  3402.  
  3403.  
  3404.  
  3405.  
  3406.  
  3407. // Load Portfolio Slider
  3408.  
  3409. if ( $options['dynamic_element_type'] == '_pslider' ) {
  3410.  
  3411. wp_enqueue_style('pslider', get_template_directory_uri() . '/sliders/caroufredsel/caroufredsel.css', 'zn-style');
  3412.  
  3413. //wp_enqueue_style( 'lslider');
  3414.  
  3415. wp_enqueue_script('pslider', get_template_directory_uri() . '/sliders/caroufredsel/jquery.carouFredSel-6.0.4-packed.js',array('jquery'),'6.0.4',true);
  3416.  
  3417.  
  3418.  
  3419. if ( $options['ps_sliding_direction'] == 'Vertical' ) {
  3420.  
  3421. $zn_portfolio_slider = array ( 'zn_portfolio_slider' =>
  3422.  
  3423. "
  3424.  
  3425. (function($){
  3426.  
  3427. var left = {
  3428.  
  3429. imgFront : 365,
  3430.  
  3431. imgBack : 365,
  3432.  
  3433. imgBack2 : 365
  3434.  
  3435. },
  3436.  
  3437. current = {
  3438.  
  3439. imgFront : 0,
  3440.  
  3441. imgBack : 80,
  3442.  
  3443. imgBack2 : 50
  3444.  
  3445. },
  3446.  
  3447. right = {
  3448.  
  3449. imgFront : 365,
  3450.  
  3451. imgBack : 365,
  3452.  
  3453. imgBack2 : 365
  3454.  
  3455. },
  3456.  
  3457. cSpeed = 400,
  3458.  
  3459. cEasing = 'easeOutExpo',
  3460.  
  3461. isScrolling = false;
  3462.  
  3463.  
  3464.  
  3465. $('#carousel').carouFredSel({
  3466.  
  3467. scroll : {
  3468.  
  3469. duration : -1,
  3470.  
  3471. timeoutDuration : 3000
  3472.  
  3473. },
  3474.  
  3475. auto : false,
  3476.  
  3477. prev : {
  3478.  
  3479. button : '#prev',
  3480.  
  3481. conditions : function() {
  3482.  
  3483. return (!isScrolling);
  3484.  
  3485. },
  3486.  
  3487. onBefore : function( data ) {
  3488.  
  3489. isScrolling = true;
  3490.  
  3491. $(this).delay(900);
  3492.  
  3493.  
  3494.  
  3495. data.items.old.find('.img-front').delay(700).animate({top: right.imgFront}, cSpeed, cEasing);
  3496.  
  3497. data.items.old.find('img.img-back').delay(500).animate({top: right.imgBack}, cSpeed, cEasing);
  3498.  
  3499. data.items.old.find('img.img-back2').delay(300).animate({top: right.imgBack2}, cSpeed, cEasing);
  3500.  
  3501. },
  3502.  
  3503. onAfter: function( data ) {
  3504.  
  3505.  
  3506.  
  3507. data.items.old.find('.img-front').css({top: current.imgFront});
  3508.  
  3509. data.items.old.find('img.img-back').css({top: current.imgBack});
  3510.  
  3511. data.items.old.find('img.img-back2').css({top: current.imgBack2});
  3512.  
  3513. data.items.visible.find('.img-front').css({top: left.imgFront}).delay(700).animate({top: current.imgFront}, cSpeed, cEasing, function() {
  3514.  
  3515. isScrolling = false;
  3516.  
  3517. });
  3518.  
  3519. data.items.visible.find('img.img-back').css({top: left.imgBack}).delay(500).animate({top: current.imgBack}, cSpeed, cEasing);
  3520.  
  3521. data.items.visible.find('img.img-back2').css({top: left.imgBack2}).delay(300).animate({top: current.imgBack2}, cSpeed, cEasing);
  3522.  
  3523.  
  3524.  
  3525. }
  3526.  
  3527. },
  3528.  
  3529. next : {
  3530.  
  3531. button : '#next',
  3532.  
  3533. conditions : function() {
  3534.  
  3535. return (!isScrolling);
  3536.  
  3537. },
  3538.  
  3539. onBefore : function( data ) {
  3540.  
  3541. isScrolling = true;
  3542.  
  3543. $(this).delay(900); // delay the onafter
  3544.  
  3545. data.items.old.find('.img-front').animate({top: left.imgFront}, cSpeed, cEasing);
  3546.  
  3547. data.items.old.find('img.img-back').delay(300).animate({top: left.imgBack}, cSpeed, cEasing);
  3548.  
  3549. data.items.old.find('img.img-back2').delay(500).animate({top: left.imgBack2}, cSpeed, cEasing);
  3550.  
  3551. },
  3552.  
  3553. onAfter: function( data ) {
  3554.  
  3555. data.items.old.find('.img-front').css({top: current.imgFront});
  3556.  
  3557. data.items.old.find('img.img-back').css({top: current.imgBack});
  3558.  
  3559. data.items.old.find('img.img-back2').css({top: current.imgBack2});
  3560.  
  3561.  
  3562.  
  3563. data.items.visible.find('.img-front').css({top: right.imgFront}).animate({top: current.imgFront}, cSpeed, cEasing);
  3564.  
  3565. data.items.visible.find('img.img-back').css({top: right.imgBack}).delay(200).animate({top: current.imgBack}, cSpeed, cEasing);
  3566.  
  3567. data.items.visible.find('img.img-back2').css({top: right.imgBack2}).delay(300).animate({top: current.imgBack2}, cSpeed, cEasing, function() {
  3568.  
  3569. isScrolling = false;
  3570.  
  3571. });
  3572.  
  3573.  
  3574.  
  3575.  
  3576.  
  3577. }
  3578.  
  3579. }
  3580.  
  3581.  
  3582.  
  3583. });
  3584.  
  3585.  
  3586.  
  3587. if($('#carousel').hasClass('animating_frames')) {
  3588.  
  3589. var _tf = $('#carousel .img-front'),
  3590.  
  3591. _tb = $('#carousel img.img-back'),
  3592.  
  3593. _tbl = $('#carousel img.img-back2'),
  3594.  
  3595. _spd = 250,
  3596.  
  3597. _eas = 'easeOutExpo';
  3598.  
  3599.  
  3600.  
  3601. _tb.hover(function(){
  3602.  
  3603. $(this).animate({'margin-top':-40}, _spd, _eas);
  3604.  
  3605. _tf.animate({'margin-left':-90}, _spd, _eas);
  3606.  
  3607. _tbl.animate({'margin-left':-30}, _spd, _eas);
  3608.  
  3609. },function(){
  3610.  
  3611. $(this).animate({'margin-top':0}, _spd, _eas);
  3612.  
  3613. _tf.animate({'margin-left':0}, _spd, _eas);
  3614.  
  3615. _tbl.animate({'margin-left':0}, _spd, _eas);
  3616.  
  3617. });
  3618.  
  3619. _tbl.hover(function(){
  3620.  
  3621. $(this).animate({'margin-top':-20}, _spd, _eas);
  3622.  
  3623. _tf.animate({'margin-left':90}, _spd, _eas);
  3624.  
  3625. _tb.animate({'margin-left':20}, _spd, _eas);
  3626.  
  3627. },function(){
  3628.  
  3629. $(this).animate({'margin-top':0}, _spd, _eas);
  3630.  
  3631. _tf.animate({'margin-left':0}, _spd, _eas);
  3632.  
  3633. _tb.animate({'margin-left':0}, _spd, _eas);
  3634.  
  3635. });
  3636.  
  3637. }
  3638.  
  3639. })(jQuery);
  3640.  
  3641. ");
  3642.  
  3643. }
  3644.  
  3645. else {
  3646.  
  3647. $zn_portfolio_slider = array ( 'zn_portfolio_slider' =>
  3648.  
  3649. "
  3650.  
  3651. (function($){
  3652.  
  3653. var left = {
  3654.  
  3655. imgFront : -1200,
  3656.  
  3657. imgBack : -1200,
  3658.  
  3659. imgBack2 : -1200
  3660.  
  3661. }
  3662.  
  3663. var current = {
  3664.  
  3665. imgFront : 261,
  3666.  
  3667. imgBack : 470,
  3668.  
  3669. imgBack2 : 60
  3670.  
  3671. }
  3672.  
  3673. var right = {
  3674.  
  3675. imgFront : 2200,
  3676.  
  3677. imgBack : 2200,
  3678.  
  3679. imgBack2 : 2200
  3680.  
  3681. }
  3682.  
  3683.  
  3684.  
  3685. var isScrolling = false;
  3686.  
  3687.  
  3688.  
  3689. $('#carousel').carouFredSel({
  3690.  
  3691. scroll : {
  3692.  
  3693. duration : 0,
  3694.  
  3695. timeoutDuration : 3000
  3696.  
  3697. },
  3698.  
  3699. auto : false,
  3700.  
  3701. width: '100%',
  3702.  
  3703. prev : {
  3704.  
  3705. button : '#prev',
  3706.  
  3707. conditions : function() {
  3708.  
  3709. return (!isScrolling);
  3710.  
  3711. },
  3712.  
  3713. onBefore : function( data ) {
  3714.  
  3715. isScrolling = true;
  3716.  
  3717.  
  3718.  
  3719. $(this).delay(900);
  3720.  
  3721.  
  3722.  
  3723. data.items.old.find('.img-front').delay(400).animate({left: right.imgFront});
  3724.  
  3725. data.items.old.find('img.img-back').delay(300).animate({left: right.imgBack});
  3726.  
  3727. data.items.old.find('img.img-back2').delay(200).animate({left: right.imgBack2});
  3728.  
  3729. },
  3730.  
  3731. onAfter: function( data ) {
  3732.  
  3733. data.items.old.find('.img-front').css({left: current.imgFront});
  3734.  
  3735. data.items.old.find('img.img-back').css({left: current.imgBack});
  3736.  
  3737. data.items.old.find('img.img-back2').css({left: current.imgBack2});
  3738.  
  3739. data.items.visible.find('.img-front').css({left: left.imgFront}).delay(400).animate({left: current.imgFront}, function() {
  3740.  
  3741. isScrolling = false;
  3742.  
  3743. });
  3744.  
  3745. data.items.visible.find('img.img-back').css({left: left.imgBack}).delay(300).animate({left: current.imgBack});
  3746.  
  3747. data.items.visible.find('img.img-back2').css({left: left.imgBack2}).delay(200).animate({left: current.imgBack2});
  3748.  
  3749.  
  3750.  
  3751. }
  3752.  
  3753. },
  3754.  
  3755. next : {
  3756.  
  3757. button : '#next',
  3758.  
  3759. conditions : function() {
  3760.  
  3761. return (!isScrolling);
  3762.  
  3763. },
  3764.  
  3765. onBefore : function( data ) {
  3766.  
  3767. isScrolling = true;
  3768.  
  3769.  
  3770.  
  3771. $(this).delay(900); // delay the onafter
  3772.  
  3773. data.items.old.find('.img-front').animate({left: left.imgFront});
  3774.  
  3775. data.items.old.find('img.img-back').delay(100).animate({left: left.imgBack});
  3776.  
  3777. data.items.old.find('img.img-back2').delay(200).animate({left: left.imgBack2});
  3778.  
  3779. },
  3780.  
  3781. onAfter: function( data ) {
  3782.  
  3783. data.items.old.find('.img-front').css({left: current.imgFront});
  3784.  
  3785. data.items.old.find('img.img-back').css({left: current.imgBack});
  3786.  
  3787. data.items.old.find('img.img-back2').css({left: current.imgBack2});
  3788.  
  3789.  
  3790.  
  3791. data.items.visible.find('.img-front').css({left: right.imgFront}).animate({left: current.imgFront});
  3792.  
  3793. data.items.visible.find('img.img-back').css({left: right.imgBack}).delay(100).animate({left: current.imgBack});
  3794.  
  3795. data.items.visible.find('img.img-back2').css({left: right.imgBack2}).delay(200).animate({left: current.imgBack2}, function() {
  3796.  
  3797. isScrolling = false;
  3798.  
  3799. });
  3800.  
  3801. }
  3802.  
  3803. }
  3804.  
  3805. });
  3806.  
  3807.  
  3808.  
  3809.  
  3810.  
  3811. })(jQuery);
  3812.  
  3813. ");
  3814.  
  3815.  
  3816.  
  3817. }
  3818.  
  3819. zn_update_array( $zn_portfolio_slider );
  3820.  
  3821.  
  3822.  
  3823.  
  3824.  
  3825.  
  3826.  
  3827. }
  3828.  
  3829.  
  3830.  
  3831. // Load isotope
  3832.  
  3833. if ( $options['dynamic_element_type'] == '_static4' ) {
  3834.  
  3835. wp_enqueue_script('gmap', 'http://maps.google.com/maps/api/js?sensor=false',array('jquery'),'1.3',false);
  3836.  
  3837. wp_enqueue_script('gmap_mapmarker', get_template_directory_uri() . '/js/mapmarker.jquery.js',array('jquery'),'1.3',true);
  3838.  
  3839. }
  3840.  
  3841.  
  3842.  
  3843. }
  3844.  
  3845.  
  3846.  
  3847. }
  3848.  
  3849.  
  3850.  
  3851. }
  3852.  
  3853. }
  3854.  
  3855. add_action('wp_enqueue_scripts', 'smart_load');
  3856.  
  3857.  
  3858.  
  3859. /*--------------------------------------------------------------------------------------------------
  3860.  
  3861. Load the javascript files for this theme
  3862.  
  3863. --------------------------------------------------------------------------------------------------*/
  3864.  
  3865. if ( ! function_exists( 'zn_add_script' ) ) {
  3866.  
  3867. function zn_add_script()
  3868.  
  3869. {
  3870.  
  3871. global $data;
  3872.  
  3873.  
  3874.  
  3875. if (!is_admin()){
  3876.  
  3877.  
  3878.  
  3879. // ENQUEUE DEFAULT SCRIPTS
  3880.  
  3881.  
  3882.  
  3883. wp_enqueue_script('jquery');
  3884.  
  3885. wp_enqueue_script('bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js',array('jquery'),'1.3',true);
  3886.  
  3887. wp_enqueue_script('modernizr', 'http://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js', array(), '2.6.2' );
  3888.  
  3889. wp_enqueue_script('jquery-zplugins', get_template_directory_uri() . '/js/plugins.js',array('jquery'),'1.3',true);
  3890.  
  3891. wp_enqueue_script('jquerysuperfish', get_template_directory_uri() . '/addons/superfish_responsive/superfish_menu.js',array('jquery'),'1.4.8',true);
  3892.  
  3893.  
  3894.  
  3895. // Menu Follow
  3896.  
  3897. if ($data['menu_follow'] == 'yes') {
  3898.  
  3899.  
  3900.  
  3901. $zn_chaser = array ( 'zn_chaser' =>
  3902.  
  3903. "
  3904.  
  3905. (function($){
  3906.  
  3907. $(window).load(function(){
  3908.  
  3909. var doc = $(document),
  3910.  
  3911. win = $(window), chaser, forch,
  3912.  
  3913. forchBottom, visible;
  3914.  
  3915. function shown() { visible = true; }
  3916.  
  3917. function hidden() { visible = false; }
  3918.  
  3919. chaser = $('#main_menu ul.sf-menu').clone().hide()
  3920.  
  3921. .appendTo(document.body)
  3922.  
  3923. .wrap(\"<div class='chaser'><div class='container'><div class='row'><div class='span12'></div></div></div></div>\");
  3924.  
  3925. if ( $('#content').length > 0 ) {
  3926.  
  3927. forch = $('#content').first();
  3928.  
  3929. forchBottom = forch.offset().top + 2;
  3930.  
  3931. hidden();
  3932.  
  3933. win.on('scroll', function () {
  3934.  
  3935.  
  3936.  
  3937. var top = doc.scrollTop();
  3938.  
  3939. if (!visible && top > forchBottom) {
  3940.  
  3941. //chaser.slideDown(300, shown);
  3942.  
  3943. chaser.fadeIn(300, shown);
  3944.  
  3945. } else if (visible && top < forchBottom) {
  3946.  
  3947. //chaser.slideUp(200, hidden);
  3948.  
  3949. chaser.fadeOut(200, hidden);
  3950.  
  3951. }
  3952.  
  3953. });
  3954.  
  3955. }
  3956.  
  3957. /* Activate Superfish Menu for Chaser */
  3958.  
  3959. $('.chaser ul.sf-menu').supersubs({ minWidth: 12, maxWidth: 27, extraWidth: 1}).superfish({delay:250, dropShadows:false, autoArrows:true, speed:300});
  3960.  
  3961. });
  3962.  
  3963. })(jQuery);
  3964.  
  3965. ");
  3966.  
  3967.  
  3968.  
  3969. zn_update_array( $zn_chaser );
  3970.  
  3971.  
  3972.  
  3973. }
  3974.  
  3975.  
  3976.  
  3977. if ( $data['page_preloader'] == 'yes' ) {
  3978.  
  3979.  
  3980.  
  3981. $zn_preloader = array ( 'zn_preloader' =>
  3982.  
  3983. "
  3984.  
  3985. (function($){
  3986.  
  3987. var pageLoading = $('#page-loading');
  3988.  
  3989. if(pageLoading.length > 0){
  3990.  
  3991. setTimeout(function() {
  3992.  
  3993. pageLoading.fadeOut();
  3994.  
  3995. }, 1000);
  3996.  
  3997. }
  3998.  
  3999. })(jQuery);
  4000.  
  4001. ");
  4002.  
  4003.  
  4004.  
  4005. zn_update_array( $zn_preloader );
  4006.  
  4007.  
  4008.  
  4009. }
  4010.  
  4011.  
  4012.  
  4013. // RESPONSIVE MENU
  4014.  
  4015. if ( empty ( $data['res_menu_style'] ) || $data['res_menu_style'] == 'select' ) {
  4016.  
  4017.  
  4018.  
  4019. $zn_smooth_menu = array ( 'zn_smooth_menu' =>
  4020.  
  4021. "
  4022.  
  4023. (function($){
  4024.  
  4025. $(document).ready(function(){
  4026.  
  4027. /* Activate Superfish Menu */
  4028.  
  4029. var sfDelay = 600;
  4030.  
  4031. if($('html').hasClass('isie'))
  4032.  
  4033. sfDelay = 300;
  4034.  
  4035. $('#main_menu > ul')
  4036.  
  4037. .supersubs({
  4038.  
  4039. minWidth: 12, // minimum width of sub-menus in em units
  4040.  
  4041. maxWidth: 27, // maximum width of sub-menus in em units
  4042.  
  4043. extraWidth: 1 // extra width can ensure lines don't sometimes turn over
  4044.  
  4045. }).superfish({
  4046.  
  4047. delay:sfDelay,
  4048.  
  4049. dropShadows:false,
  4050.  
  4051. autoArrows:true,
  4052.  
  4053. speed:300
  4054.  
  4055. }).mobileMenu({
  4056.  
  4057. switchWidth: 960,
  4058.  
  4059. topOptionText: '".__("SELECT A PAGE",THEMENAME)."',
  4060.  
  4061. indentString: '&nbsp;&nbsp;&nbsp;'
  4062.  
  4063. });
  4064.  
  4065. });
  4066.  
  4067. })(jQuery);
  4068.  
  4069. ");
  4070.  
  4071.  
  4072.  
  4073. zn_update_array( $zn_smooth_menu );
  4074.  
  4075.  
  4076.  
  4077. }
  4078.  
  4079. elseif ( !empty ( $data['res_menu_style'] ) && $data['res_menu_style'] == 'smooth' ) {
  4080.  
  4081.  
  4082.  
  4083. $zn_smooth_menu = array ( 'zn_smooth_menu' =>
  4084.  
  4085. "
  4086.  
  4087. (function($){
  4088.  
  4089. $(document).ready(function(){
  4090.  
  4091. /* Activate Superfish Menu */
  4092.  
  4093. var sfDelay = 600;
  4094.  
  4095. if($('html').hasClass('isie'))
  4096.  
  4097. sfDelay = 300;
  4098.  
  4099. $('#main_menu > ul')
  4100.  
  4101. .supersubs({
  4102.  
  4103. minWidth: 12, // minimum width of sub-menus in em units
  4104.  
  4105. maxWidth: 27, // maximum width of sub-menus in em units
  4106.  
  4107. extraWidth: 1 // extra width can ensure lines don't sometimes turn over
  4108.  
  4109. }).superfish({
  4110.  
  4111. delay:sfDelay,
  4112.  
  4113. dropShadows:false,
  4114.  
  4115. autoArrows:true,
  4116.  
  4117. speed:300
  4118.  
  4119. });
  4120.  
  4121. });
  4122.  
  4123.  
  4124.  
  4125.  
  4126.  
  4127. $(window).resize(function() {
  4128.  
  4129. $('#main_menu > ul')
  4130.  
  4131. .supersubs({
  4132.  
  4133. minWidth: 12, // minimum width of sub-menus in em units
  4134.  
  4135. maxWidth: 27, // maximum width of sub-menus in em units
  4136.  
  4137. extraWidth: 1 // extra width can ensure lines don't sometimes turn over
  4138.  
  4139. });
  4140.  
  4141. });
  4142.  
  4143.  
  4144.  
  4145. })(jQuery);
  4146.  
  4147. ");
  4148.  
  4149.  
  4150.  
  4151. zn_update_array( $zn_smooth_menu );
  4152.  
  4153. }
  4154.  
  4155.  
  4156.  
  4157. // Prety photo
  4158.  
  4159. wp_enqueue_script('pretty_photo', get_template_directory_uri() . '/addons/prettyphoto/jquery.prettyPhoto.js',array('jquery'),'1.3',true);
  4160.  
  4161.  
  4162.  
  4163. if ( is_active_widget( false, false, 'zn_twitter', true ) ) {
  4164.  
  4165. wp_enqueue_script('twitter_plugin', get_template_directory_uri() . '/addons/twitterfeed/twitter.min.js',array('jquery'),'1.4.8',true);
  4166.  
  4167. }
  4168.  
  4169.  
  4170.  
  4171. if ( is_tax( 'project_category' ) && $data['portfolio_style'] == 'portfolio_sortable' ) {
  4172.  
  4173. wp_enqueue_script('isotope', get_template_directory_uri() . '/js/jquery.isotope.min.js',array('jquery'),'1.4.8',true);
  4174.  
  4175.  
  4176.  
  4177. $zn_isotope = array ( 'zn_isotope' =>
  4178.  
  4179. "
  4180.  
  4181. (function($){
  4182.  
  4183. $(window).load(function(){
  4184.  
  4185.  
  4186.  
  4187. // settings
  4188.  
  4189. var sortBy = 'date', // SORTING: date / name
  4190.  
  4191. sortAscending = true, // SORTING ORDER: true = Ascending / false = Descending
  4192.  
  4193. theFilter = ''; // DEFAULT FILTERING CATEGORY
  4194.  
  4195.  
  4196.  
  4197. $('#sortBy li a').each(function(index, element) {
  4198.  
  4199. var t = $(this);
  4200.  
  4201. if(t.attr('data-option-value') == sortBy)
  4202.  
  4203. t.addClass('selected');
  4204.  
  4205. });
  4206.  
  4207. $('#sort-direction li a').each(function(index, element) {
  4208.  
  4209. var t = $(this);
  4210.  
  4211. if(t.attr('data-option-value') == sortAscending.toString())
  4212.  
  4213. t.addClass('selected');
  4214.  
  4215. });
  4216.  
  4217. $('#portfolio-nav li a').each(function(index, element) {
  4218.  
  4219. var t = $(this),
  4220.  
  4221. tpar = t.parent();
  4222.  
  4223. if(t.attr('data-filter') == theFilter) {
  4224.  
  4225. $('#portfolio-nav li a').parent().removeClass('current');
  4226.  
  4227. tpar.addClass('current');
  4228.  
  4229. }
  4230.  
  4231. });
  4232.  
  4233.  
  4234.  
  4235. // don't edit below unless you know what you're doing
  4236.  
  4237. if ($(\"ul#thumbs\").length > 0){
  4238.  
  4239. var container = $(\"ul#thumbs\");
  4240.  
  4241. container.isotope({
  4242.  
  4243. itemSelector : \".item\",
  4244.  
  4245. animationEngine : \"jquery\",
  4246.  
  4247. animationOptions: {
  4248.  
  4249. duration: 250,
  4250.  
  4251. easing: \"easeOutExpo\",
  4252.  
  4253. queue: false
  4254.  
  4255. },
  4256.  
  4257. filter: theFilter,
  4258.  
  4259. sortAscending : sortAscending,
  4260.  
  4261. getSortData : {
  4262.  
  4263. name : function ( elem ) {
  4264.  
  4265. return elem.find(\"span.name\").text();
  4266.  
  4267. },
  4268.  
  4269. date : function ( elem ) {
  4270.  
  4271. return elem.attr(\"data-date\");
  4272.  
  4273. }
  4274.  
  4275. },
  4276.  
  4277. sortBy: sortBy
  4278.  
  4279. });
  4280.  
  4281.  
  4282.  
  4283. }
  4284.  
  4285. });
  4286.  
  4287. })(jQuery);
  4288.  
  4289. ");
  4290.  
  4291.  
  4292.  
  4293. zn_update_array( $zn_isotope );
  4294.  
  4295.  
  4296.  
  4297.  
  4298.  
  4299. }
  4300.  
  4301.  
  4302.  
  4303. if ( is_tax( 'project_category' ) && $data['portfolio_style'] == 'portfolio_carousel' ) {
  4304.  
  4305. wp_enqueue_script('isotope', get_template_directory_uri() . '/js/jquery.isotope.min.js',array('jquery'),'1.4.8',true);
  4306.  
  4307.  
  4308.  
  4309. wp_enqueue_script('pslider', get_template_directory_uri() . '/sliders/caroufredsel/jquery.carouFredSel-6.0.4-packed.js',array('jquery'),'6.0.4',true);
  4310.  
  4311.  
  4312.  
  4313. $zn_pcarousel = array ( 'zn_pcarousel' =>
  4314.  
  4315. "
  4316.  
  4317. (function($) {
  4318.  
  4319. $(window).load(function(){
  4320.  
  4321. // ** Portfolio Carousel
  4322.  
  4323. var carousels = jQuery('.ptcarousel1');
  4324.  
  4325. carousels.each(function(index, element) {
  4326.  
  4327. $(this).carouFredSel({
  4328.  
  4329. responsive: true,
  4330.  
  4331. items: { width: 570 },
  4332.  
  4333. prev : { button : $(this).parent().find('a.prev'), key : \"left\" },
  4334.  
  4335. next : { button : $(this).parent().find('a.next'), key : \"right\" },
  4336.  
  4337. auto: {timeoutDuration: 5000},
  4338.  
  4339. scroll: { fx: \"crossfade\", duration: \"1500\" }
  4340.  
  4341. });
  4342.  
  4343. });
  4344.  
  4345. // *** end Portfolio Carousel
  4346.  
  4347. });
  4348.  
  4349. })(jQuery);
  4350.  
  4351. ");
  4352.  
  4353.  
  4354.  
  4355. zn_update_array( $zn_pcarousel );
  4356.  
  4357.  
  4358.  
  4359.  
  4360.  
  4361. }
  4362.  
  4363.  
  4364.  
  4365. // WOOCOMMERCE CART
  4366.  
  4367. include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
  4368.  
  4369. if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
  4370.  
  4371.  
  4372.  
  4373. global $data;
  4374.  
  4375.  
  4376.  
  4377. if ( $data['woo_show_cart'] ) {
  4378.  
  4379. global $woocommerce;
  4380.  
  4381.  
  4382.  
  4383. $zn_woo_cart = array ( 'zn_woo_cart' =>
  4384.  
  4385. "
  4386.  
  4387. (function($) {
  4388.  
  4389. $(window).load(function(){
  4390.  
  4391. $('body').bind('added_to_cart',function (evt,ret) {
  4392.  
  4393.  
  4394.  
  4395. var mycart = $('#mycartbtn'), // trebuie adaugat id-ul
  4396.  
  4397. mycartTop = mycart.offset().top;
  4398.  
  4399. mycartLeft = mycart.offset().left,
  4400.  
  4401. butonCart = $('.to_cart button.addtocart '),
  4402.  
  4403. buttonCartHome = $('.add_to_cart_button '),
  4404.  
  4405. placeholderdiv = $(\"<div class='popupaddcart'>".__("Item Added to cart!",THEMENAME)."</div>\"),
  4406.  
  4407. $('body').append(placeholderdiv);
  4408.  
  4409. $(placeholderdiv).hide();
  4410.  
  4411.  
  4412.  
  4413. $(placeholderdiv).fadeIn('slow', 'easeInOutExpo',function(){
  4414.  
  4415.  
  4416.  
  4417. var zn_pos_top = $(this).offset().top,
  4418.  
  4419. zn_pos_left = $(this).offset().left;
  4420.  
  4421.  
  4422.  
  4423. $(this).css({margin:0,left:zn_pos_left,top:zn_pos_top,position:\"absolute\"}).delay(800).animate({\"top\": mycartTop, left:mycartLeft, opacity:1}, 2000, 'easeInOutExpo',function(){
  4424.  
  4425. $(this).remove();
  4426.  
  4427.  
  4428.  
  4429. });
  4430.  
  4431.  
  4432.  
  4433. })
  4434.  
  4435. });
  4436.  
  4437. });
  4438.  
  4439. })(jQuery);
  4440.  
  4441. ");
  4442.  
  4443.  
  4444.  
  4445. zn_update_array( $zn_woo_cart );
  4446.  
  4447. }
  4448.  
  4449. }
  4450.  
  4451. global $pagenow;
  4452.  
  4453. // Event Countdown
  4454.  
  4455. if ( $data['cs_enable'] == 'yes' && !is_user_logged_in() && !is_admin() && $pagenow != 'wp-login.php' ) {
  4456.  
  4457. wp_enqueue_script('zn_event_countdown', get_template_directory_uri() . '/js/jquery.countdown.js',array('jquery'),'1.3',true);
  4458.  
  4459.  
  4460.  
  4461. $zn_event_countdown_coming_soon = array ( 'zn_event_countdown_coming_soon' =>
  4462.  
  4463. "
  4464.  
  4465. (function($) {
  4466.  
  4467. var counter = {
  4468.  
  4469. init: function (d)
  4470.  
  4471. {
  4472.  
  4473. jQuery('#Counter').countdown({
  4474.  
  4475. until: new Date(d),
  4476.  
  4477. layout: counter.layout(),
  4478.  
  4479. labels: ['".__('years',THEMENAME)."', '".__('months',THEMENAME)."', '".__('weeks',THEMENAME)."', '".__('days',THEMENAME)."', '".__('hours',THEMENAME)."', '".__('min',THEMENAME)."', '".__('sec',THEMENAME)."'],
  4480.  
  4481. labels1: ['".__('year',THEMENAME)."', '".__('month',THEMENAME)."', '".__('week',THEMENAME)."', '".__('day',THEMENAME)."', '".__('hour',THEMENAME)."', '".__('min',THEMENAME)."', '".__('sec',THEMENAME)."']
  4482.  
  4483. });
  4484.  
  4485. },
  4486.  
  4487. layout: function ()
  4488.  
  4489. {
  4490.  
  4491. return '<li>{dn}<span>{dl}</span></li>' +
  4492.  
  4493. '<li>{hnn}<span>{hl}</span></li>' +
  4494.  
  4495. '<li>{mnn}<span>{ml}</span></li>' +
  4496.  
  4497. '<li>{snn}<span>{sl}</span></li>';
  4498.  
  4499. }
  4500.  
  4501. }
  4502.  
  4503.  
  4504.  
  4505. // initialize the counter
  4506.  
  4507. jQuery(document).ready(function() {
  4508.  
  4509. counter.init(\"".$data['cs_date']['date']." ".$data['cs_date']['time']."\");
  4510.  
  4511. });
  4512.  
  4513. })(jQuery);
  4514.  
  4515. ");
  4516.  
  4517.  
  4518.  
  4519. zn_update_array( $zn_event_countdown_coming_soon );
  4520.  
  4521.  
  4522.  
  4523. $zn_mailchimp = array ( 'zn_mailchimp' =>
  4524.  
  4525. "// PREPARE THE NEWSLETTER AND SEND DATA TO MAILCHIMP
  4526.  
  4527. jQuery('.nl-submit').click(function() {
  4528.  
  4529.  
  4530.  
  4531. ajax_url = jQuery(this).parent().attr('data-url');
  4532.  
  4533. result_placeholder = jQuery(this).parent().next('span.zn_mailchimp_result');
  4534.  
  4535.  
  4536.  
  4537.  
  4538.  
  4539. jQuery.ajax({
  4540.  
  4541. url: ajax_url,
  4542.  
  4543. type: 'POST',
  4544.  
  4545. data: {
  4546.  
  4547. zn_mc_email: jQuery(this).prevAll('.nl-email').val(),
  4548.  
  4549. zn_mailchimp_list: jQuery(this).prev('.nl-lid').val(),
  4550.  
  4551. zn_ajax: '' // Change here with something different
  4552.  
  4553. },
  4554.  
  4555. success: function(data){
  4556.  
  4557. result_placeholder.html(data);
  4558.  
  4559.  
  4560.  
  4561. },
  4562.  
  4563. error: function() {
  4564.  
  4565. result_placeholder.html('ERROR.').css('color', 'red');
  4566.  
  4567. }
  4568.  
  4569. });
  4570.  
  4571. return false;
  4572.  
  4573. });
  4574.  
  4575. ");
  4576.  
  4577.  
  4578.  
  4579. zn_update_array( $zn_mailchimp );
  4580.  
  4581. }
  4582.  
  4583.  
  4584.  
  4585. // Load the theme scripts
  4586.  
  4587. wp_enqueue_script('zn-script', get_template_directory_uri() . '/js/znscript.js',array('jquery'),'1.0.0',true);
  4588.  
  4589. wp_localize_script( 'zn-script', 'zn_do_login', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
  4590.  
  4591.  
  4592.  
  4593. }
  4594.  
  4595. }
  4596.  
  4597. }
  4598.  
  4599. add_action('wp_enqueue_scripts','zn_add_script');
  4600.  
  4601.  
  4602.  
  4603. /*--------------------------------------------------------------------------------------------------
  4604.  
  4605. Update inline scripts
  4606.  
  4607. --------------------------------------------------------------------------------------------------*/
  4608.  
  4609. if ( ! function_exists( 'zn_update_array' ) ) {
  4610.  
  4611. function zn_update_array($script) {
  4612.  
  4613.  
  4614.  
  4615. global $zn_array;
  4616.  
  4617. $zn_array[key ($script)] = $script[key ($script)];
  4618.  
  4619.  
  4620.  
  4621. }
  4622.  
  4623. }
  4624.  
  4625.  
  4626.  
  4627. /*--------------------------------------------------------------------------------------------------
  4628.  
  4629. Load the inline JS
  4630.  
  4631. --------------------------------------------------------------------------------------------------*/
  4632.  
  4633.  
  4634.  
  4635. if ( ! function_exists( 'zn_load_inline_js' ) ) {
  4636.  
  4637. function zn_load_inline_js($script) {
  4638.  
  4639.  
  4640.  
  4641. global $zn_array;
  4642.  
  4643. $script = '<script type="text/javascript">';
  4644.  
  4645. foreach ( $zn_array as $tt ){
  4646.  
  4647. $script .= $tt;
  4648.  
  4649. }
  4650.  
  4651. $script .= '</script>';
  4652.  
  4653.  
  4654.  
  4655. echo $script;
  4656.  
  4657.  
  4658.  
  4659. }
  4660.  
  4661. }
  4662.  
  4663. add_action('wp_footer', 'zn_load_inline_js', 100);
  4664.  
  4665.  
  4666.  
  4667.  
  4668.  
  4669. /*--------------------------------------------------------------------------------------------------
  4670.  
  4671. Add Google analitycs to page
  4672.  
  4673. --------------------------------------------------------------------------------------------------*/
  4674.  
  4675.  
  4676.  
  4677. add_action('wp_footer', 'add_googleanalytics');
  4678.  
  4679. if ( ! function_exists( 'add_googleanalytics' ) ) {
  4680.  
  4681. function add_googleanalytics() {
  4682.  
  4683. global $data;
  4684.  
  4685. echo stripslashes($data['google_analytics']);
  4686.  
  4687. }
  4688.  
  4689. }
  4690.  
  4691.  
  4692.  
  4693. /*--------------------------------------------------------------------------------------------------
  4694.  
  4695. Register the menus : Top menu, default menu , footer menu
  4696.  
  4697. --------------------------------------------------------------------------------------------------*/
  4698.  
  4699.  
  4700.  
  4701. add_action( 'init', 'zn_register_menu' );
  4702.  
  4703. if ( ! function_exists( 'zn_register_menu' ) ) {
  4704.  
  4705. function zn_register_menu() {
  4706.  
  4707. if ( function_exists('wp_nav_menu') ) {
  4708.  
  4709. add_theme_support( 'nav-menus' );
  4710.  
  4711. register_nav_menus( array(
  4712.  
  4713. 'main_navigation' => esc_html__( 'Main Navigation', THEMENAME ),
  4714.  
  4715. ) );
  4716.  
  4717. }
  4718.  
  4719. }
  4720.  
  4721. }
  4722.  
  4723.  
  4724.  
  4725. /*--------------------------------------------------------------------------------------------------
  4726.  
  4727. Show the menu by location
  4728.  
  4729. --------------------------------------------------------------------------------------------------*/
  4730.  
  4731. if ( ! function_exists( 'zn_show_nav' ) ) {
  4732.  
  4733. function zn_show_nav($location) {
  4734.  
  4735.  
  4736.  
  4737. if($location == 'header_navigation')
  4738.  
  4739. {
  4740.  
  4741. $menu_class = 'topnav navRight ';
  4742.  
  4743. }
  4744.  
  4745. elseif($location == 'main_navigation')
  4746.  
  4747. {
  4748.  
  4749. $menu_class = 'sf-menu nav clearfix';
  4750.  
  4751. }
  4752.  
  4753. else
  4754.  
  4755. {
  4756.  
  4757. $menu_class = 'zn-footer-menu';
  4758.  
  4759. }
  4760.  
  4761.  
  4762.  
  4763.  
  4764.  
  4765. if ( function_exists( 'wp_nav_menu' ) ) {
  4766.  
  4767. wp_nav_menu( array( 'theme_location' => $location,
  4768.  
  4769. 'link_before'=> '',
  4770.  
  4771. 'link_after' => '',
  4772.  
  4773. 'container' => '',
  4774.  
  4775. 'menu_class' => $menu_class,
  4776.  
  4777. 'fallback_cb' => 'zn_nav_fallback')
  4778.  
  4779. );
  4780.  
  4781.  
  4782.  
  4783. }
  4784.  
  4785. else {
  4786.  
  4787. zn_nav_fallback();
  4788.  
  4789. }
  4790.  
  4791. }
  4792.  
  4793. }
  4794.  
  4795.  
  4796.  
  4797. /*--------------------------------------------------------------------------------------------------
  4798.  
  4799. Add specific css class to active item
  4800.  
  4801. --------------------------------------------------------------------------------------------------*/
  4802.  
  4803. add_filter( 'nav_menu_css_class', 'zn_active_item_classes', 10, 2 );
  4804.  
  4805. if ( ! function_exists( 'zn_active_item_classes' ) ) {
  4806.  
  4807. function zn_active_item_classes($classes = array(), $menu_item = false){
  4808.  
  4809.  
  4810.  
  4811. if(in_array('current-menu-item', $menu_item->classes) || in_array('current-menu-ancestor', $menu_item->classes) ){
  4812.  
  4813. $classes[] = 'active';
  4814.  
  4815. }
  4816.  
  4817.  
  4818.  
  4819. return $classes;
  4820.  
  4821. }
  4822.  
  4823. }
  4824.  
  4825.  
  4826.  
  4827. /*--------------------------------------------------------------------------------------------------
  4828.  
  4829. Callback menu function
  4830.  
  4831. --------------------------------------------------------------------------------------------------*/
  4832.  
  4833. if ( ! function_exists( 'zn_nav_fallback' ) ) {
  4834.  
  4835. function zn_nav_fallback() {
  4836.  
  4837. global $data;
  4838.  
  4839.  
  4840.  
  4841. if( isset($data['menu_exclude_pages']) && !empty($data['menu_exclude_pages'])){
  4842.  
  4843. $excluded_pages = implode(",",$data['menu_exclude_pages']);
  4844.  
  4845. }
  4846.  
  4847. else {
  4848.  
  4849. $excluded_pages = '';
  4850.  
  4851. }
  4852.  
  4853.  
  4854.  
  4855. $args = array(
  4856.  
  4857. 'depth' => 0,
  4858.  
  4859. 'show_date' => '',
  4860.  
  4861. 'date_format' => get_option('date_format'),
  4862.  
  4863. 'child_of' => 0,
  4864.  
  4865. 'exclude' => $excluded_pages,
  4866.  
  4867. 'include' => '',
  4868.  
  4869. 'title_li' => false,
  4870.  
  4871. 'echo' => 0,
  4872.  
  4873. 'authors' => '',
  4874.  
  4875. 'sort_column' => 'menu_order, post_title',
  4876.  
  4877. 'link_before' => '<span>',
  4878.  
  4879. 'link_after' => '</span>' );
  4880.  
  4881.  
  4882.  
  4883.  
  4884.  
  4885.  
  4886.  
  4887. $fall_back_menu = '<ul class="sf-menu">';
  4888.  
  4889. $fall_back_menu .= '</ul>';
  4890.  
  4891.  
  4892.  
  4893. echo $fall_back_menu;
  4894.  
  4895. }
  4896.  
  4897. }
  4898.  
  4899.  
  4900.  
  4901. /*--------------------------------------------------------------------------------------------------
  4902.  
  4903. Load video iframe from link
  4904.  
  4905. --------------------------------------------------------------------------------------------------*/
  4906.  
  4907. if ( ! function_exists( 'get_video_from_link' ) ) {
  4908.  
  4909. function get_video_from_link($string,$css = null , $width = '425px' , $height = '239px' ) {
  4910.  
  4911.  
  4912.  
  4913. // Save old string in case no video is provided
  4914.  
  4915. $old_string = $string;
  4916.  
  4917. $video_url = parse_url($string);
  4918.  
  4919.  
  4920.  
  4921. if ( $video_url['host'] == 'www.youtube.com' || $video_url['host'] == 'youtube.com' ) {
  4922.  
  4923.  
  4924.  
  4925. preg_match('#(?<=v=)[a-zA-Z0-9-]+(?=&)|(?<=v\/)[^&\n]+|(?<=v=)[^&\n]+|(?<=youtu.be/)[^&\n]+#', $string, $matches);
  4926.  
  4927. $string = '<iframe class="'.$css.'" width="'.$width.'" height="'.$height.'" src="http://www.youtube.com/embed/'.$matches[0].'?iv_load_policy=3&enablejsapi=0&wmode=transparent&modestbranding=1&rel=0&showinfo=0&feature=player_embedded" frameborder="0" allowfullscreen></iframe>';
  4928.  
  4929.  
  4930.  
  4931. }
  4932.  
  4933. else {
  4934.  
  4935. $string = preg_replace('#http://(www\.)?vimeo\.com/([^ ?\n/]+)((\?|/).*?(\n|\s))?#i', '<iframe class="youtube-player '.$css.'" type="text/html" src="http://player.vimeo.com/video/$2" width="'.$width.'" height="'.$height.'" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>', $string);
  4936.  
  4937. }
  4938.  
  4939.  
  4940.  
  4941. // If no video link was provided return the full link
  4942.  
  4943. if ( $string != $old_string ) {
  4944.  
  4945. return $string;
  4946.  
  4947. }
  4948.  
  4949. else {
  4950.  
  4951. return;
  4952.  
  4953. }
  4954.  
  4955. }
  4956.  
  4957. }
  4958.  
  4959.  
  4960.  
  4961. /*--------------------------------------------------------------------------------------------------
  4962.  
  4963. Comments display function
  4964.  
  4965. --------------------------------------------------------------------------------------------------*/
  4966.  
  4967. if ( ! function_exists( 'zn_comment' ) ) {
  4968.  
  4969. function zn_comment($comment, $args, $depth) {
  4970.  
  4971.  
  4972.  
  4973. $GLOBALS['comment'] = $comment; ?>
  4974.  
  4975.  
  4976.  
  4977. <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
  4978.  
  4979. <div id="comment-<?php comment_ID(); ?>">
  4980.  
  4981. <div class="comment-author vcard">
  4982.  
  4983. <?php echo get_avatar($comment,$size='50' ); ?>
  4984.  
  4985. <?php printf(__('<cite class="fn">%s</cite>',THEMENAME), get_comment_author_link()) ?> <?php echo __("says :",THEMENAME); ?> <?php comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
  4986.  
  4987. </div>
  4988.  
  4989.  
  4990.  
  4991. <?php if ($comment->comment_approved == '0') : ?>
  4992.  
  4993. <em><?php _e('Your comment is awaiting moderation.',THEMENAME) ?></em>
  4994.  
  4995. <br />
  4996.  
  4997. <?php endif; ?>
  4998.  
  4999.  
  5000.  
  5001. <div class="comment-meta commentmetadata"><a href="<?php echo htmlspecialchars(get_comment_link( $comment->comment_ID )) ?>">
  5002.  
  5003. <?php printf(__('%1$s at %2$s',THEMENAME), get_comment_date(),get_comment_time()) ?></a><?php edit_comment_link(__('(Edit)',THEMENAME),' ','') ?></div>
  5004.  
  5005.  
  5006.  
  5007. <?php comment_text() ?><div class="zn-separator sep_normal zn-margin-d"></div>
  5008.  
  5009. <?php if($args['max_depth']!=$depth) { ?>
  5010.  
  5011. <?php } ?>
  5012.  
  5013. </div>
  5014.  
  5015. <?php
  5016.  
  5017. }
  5018.  
  5019. }
  5020.  
  5021.  
  5022.  
  5023. /*--------------------------------------------------------------------------------------------------
  5024.  
  5025. Sidebar Functions
  5026.  
  5027. --------------------------------------------------------------------------------------------------*/
  5028.  
  5029.  
  5030.  
  5031. if ( function_exists('register_sidebar') ) {
  5032.  
  5033. register_sidebar(array(
  5034.  
  5035. 'name' => 'Default Sidebar',
  5036.  
  5037. 'id' => 'defaultsidebar',
  5038.  
  5039. 'description' => esc_html__('This is the default sidebar. You can choose from the theme\'s options page where the widgets from this sidebar will be shown.'),
  5040.  
  5041. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  5042.  
  5043. 'after_widget' => '</div>',
  5044.  
  5045. 'before_title' => '<h3 class="widgettitle title">',
  5046.  
  5047. 'after_title' => '</h3>'
  5048.  
  5049. ));
  5050.  
  5051. }
  5052.  
  5053.  
  5054.  
  5055. if ( function_exists('register_sidebar') ) {
  5056.  
  5057. register_sidebar(array(
  5058.  
  5059. 'name' => 'Hidden Panel Sidebar',
  5060.  
  5061. 'id' => 'hiddenpannelsidebar',
  5062.  
  5063. 'description' => esc_html__('This is the sidebar for the hidden panel in the header. You can choose from the theme\'s options page where the widgets from this sidebar will be shown.'),
  5064.  
  5065. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  5066.  
  5067. 'after_widget' => '</div>',
  5068.  
  5069. 'before_title' => '<h3 class="widgettitle title">',
  5070.  
  5071. 'after_title' => '</h3>'
  5072.  
  5073. ));
  5074.  
  5075. }
  5076.  
  5077.  
  5078.  
  5079. /*--------------------------------------------------------------------------------------------------
  5080.  
  5081. Hidden pannel Sidebar
  5082.  
  5083. --------------------------------------------------------------------------------------------------*/
  5084.  
  5085. if ( !function_exists('zn_hidden_pannel') ) {
  5086.  
  5087. function zn_hidden_pannel(){
  5088.  
  5089.  
  5090.  
  5091. if ( is_active_sidebar( 'hiddenpannelsidebar' ) ) {
  5092.  
  5093.  
  5094.  
  5095. ?>
  5096.  
  5097.  
  5098.  
  5099. <div class="support_panel" id="sliding_panel">
  5100.  
  5101. <div class="container">
  5102.  
  5103. <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('hiddenpannelsidebar') ) : endif; ;?>
  5104.  
  5105. </div>
  5106.  
  5107. </div><!-- end support panel -->
  5108.  
  5109. <?php
  5110.  
  5111. }
  5112.  
  5113. }
  5114.  
  5115. }
  5116.  
  5117.  
  5118.  
  5119.  
  5120.  
  5121. /*--------------------------------------------------------------------------------------------------
  5122.  
  5123. Footer sidebars
  5124.  
  5125. --------------------------------------------------------------------------------------------------*/
  5126.  
  5127.  
  5128.  
  5129. if ( isset ( $data['footer_row1_widget_positions'] ) && !empty ( $data['footer_row1_widget_positions'] ) ) {
  5130.  
  5131.  
  5132.  
  5133.  
  5134.  
  5135. $f_row1 = key( json_decode ( stripslashes ( $data['footer_row1_widget_positions'] ) ) );
  5136.  
  5137.  
  5138.  
  5139. if ( function_exists('register_sidebars') ) {
  5140.  
  5141.  
  5142.  
  5143. if ( $f_row1 > 1 ) {
  5144.  
  5145.  
  5146.  
  5147. $args = array(
  5148.  
  5149. 'name' => 'Footer row 1 - widget %d',
  5150.  
  5151. 'id' => "znfooter",
  5152.  
  5153. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  5154.  
  5155. 'after_widget' => '</div>',
  5156.  
  5157. 'before_title' => '<h3 class="widgettitle title m_title">',
  5158.  
  5159. 'after_title' => '</h3>' );
  5160.  
  5161.  
  5162.  
  5163. register_sidebars($f_row1 ,$args);
  5164.  
  5165. }
  5166.  
  5167. else{
  5168.  
  5169. $args = array(
  5170.  
  5171. 'name' => 'Footer row 1 - widget 1',
  5172.  
  5173. 'id' => "znfooter",
  5174.  
  5175. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  5176.  
  5177. 'after_widget' => '</div>',
  5178.  
  5179. 'before_title' => '<h3 class="widgettitle title m_title">',
  5180.  
  5181. 'after_title' => '</h3>' );
  5182.  
  5183. register_sidebars( 1,wp_parse_args( $singleargs, $args ));
  5184.  
  5185. }
  5186.  
  5187.  
  5188.  
  5189. }
  5190.  
  5191.  
  5192.  
  5193. }
  5194.  
  5195.  
  5196.  
  5197. if ( isset ( $data['footer_row2_widget_positions'] ) && !empty ( $data['footer_row2_widget_positions'] ) ) {
  5198.  
  5199.  
  5200.  
  5201. $f_row1 = key( json_decode ( stripslashes ( $data['footer_row2_widget_positions'] ) ) );
  5202.  
  5203.  
  5204.  
  5205. if ( function_exists('register_sidebars') ) {
  5206.  
  5207.  
  5208.  
  5209. if ( $f_row1 > 1 ) {
  5210.  
  5211.  
  5212.  
  5213. $args = array(
  5214.  
  5215. 'name' => 'Footer row 2 - widget %d',
  5216.  
  5217. 'id' => "znfooter",
  5218.  
  5219. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  5220.  
  5221. 'after_widget' => '</div>',
  5222.  
  5223. 'before_title' => '<h3 class="widgettitle title m_title">',
  5224.  
  5225. 'after_title' => '</h3>' );
  5226.  
  5227.  
  5228.  
  5229. register_sidebars($f_row1 ,$args);
  5230.  
  5231. }
  5232.  
  5233. else{
  5234.  
  5235. $args = array(
  5236.  
  5237. 'name' => 'Footer row 2 - widget 1',
  5238.  
  5239. 'id' => "znfooter",
  5240.  
  5241. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  5242.  
  5243. 'after_widget' => '</div>',
  5244.  
  5245. 'before_title' => '<h3 class="widgettitle title m_title">',
  5246.  
  5247. 'after_title' => '</h3>' );
  5248.  
  5249. register_sidebars( 1,wp_parse_args( $singleargs, $args ));
  5250.  
  5251. }
  5252.  
  5253.  
  5254.  
  5255. }
  5256.  
  5257.  
  5258.  
  5259. }
  5260.  
  5261.  
  5262.  
  5263. /*--------------------------------------------------------------------------------------------------
  5264.  
  5265. Dynamic Sidebars Function
  5266.  
  5267. --------------------------------------------------------------------------------------------------*/
  5268.  
  5269.  
  5270.  
  5271. if ( isset ( $data['sidebar_generator'] ) && is_array ($data['sidebar_generator']) ) {
  5272.  
  5273.  
  5274.  
  5275. $sidebars = $data['sidebar_generator'];
  5276.  
  5277.  
  5278.  
  5279. foreach ($data['sidebar_generator'] as $sidebar) {
  5280.  
  5281. if ( $sidebar['sidebar_name'] ) {
  5282.  
  5283. register_sidebar(array(
  5284.  
  5285. 'name'=>$sidebar['sidebar_name'],
  5286.  
  5287. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  5288.  
  5289. 'after_widget' => '</div>',
  5290.  
  5291. 'before_title' => '<h3 class="widgettitle title">',
  5292.  
  5293. 'after_title' => '</h3>'
  5294.  
  5295. ));
  5296.  
  5297. }
  5298.  
  5299. }
  5300.  
  5301. }
  5302.  
  5303.  
  5304.  
  5305.  
  5306.  
  5307.  
  5308.  
  5309. /*--------------------------------------------------------------------------------------------------
  5310.  
  5311. Add theme support for featured image
  5312.  
  5313. --------------------------------------------------------------------------------------------------*/
  5314.  
  5315.  
  5316.  
  5317. add_theme_support( 'post-thumbnails' );
  5318.  
  5319. add_theme_support( 'automatic-feed-links' );
  5320.  
  5321.  
  5322.  
  5323. /*--------------------------------------------------------------------------------------------------
  5324.  
  5325. Modify the search form
  5326.  
  5327. --------------------------------------------------------------------------------------------------*/
  5328.  
  5329.  
  5330.  
  5331. add_filter('get_search_form', 'zn_search_form');
  5332.  
  5333. if ( ! function_exists( 'zn_search_form' ) ) {
  5334.  
  5335. function zn_search_form($form) {
  5336.  
  5337. $form = '<form role="search" method="get" id="searchform" action="' . home_url( '/' ) . '" >
  5338.  
  5339. <div class="zn_search_container">
  5340.  
  5341. <input title="' . __('Search for...',THEMENAME) . '" class="zn-inline-text" type="text" value="' . get_search_query() . '" name="s" id="s" />
  5342.  
  5343. <input class="square_button search_submit" type="submit" id="searchsubmit" value="a" /><div class="clear"></div>
  5344.  
  5345. </div>
  5346.  
  5347. </form>';
  5348.  
  5349.  
  5350.  
  5351.  
  5352.  
  5353. $form = ' <div class="search">';
  5354.  
  5355. $form .= ' <form id="searchform" action="' . home_url( '/' ) . '" method="get">';
  5356.  
  5357. $form .= ' <input id="s" name="s" maxlength="20" class="inputbox" type="text" size="20" value="'. __( 'SEARCH ...', THEMENAME ).'" onblur="if (this.value==\'\') this.value=\''. __( 'SEARCH ...', THEMENAME ).'\';" onfocus="if (this.value==\''. __( 'SEARCH ...', THEMENAME ).'\') this.value=\'\';" />';
  5358.  
  5359. $form .= ' <input type="submit" id="searchsubmit" value="go" class="icon-search"/>';
  5360.  
  5361. $form .= ' </form>';
  5362.  
  5363. $form .= ' </div>';
  5364.  
  5365.  
  5366.  
  5367.  
  5368.  
  5369. return $form;
  5370.  
  5371. }
  5372.  
  5373. }
  5374.  
  5375.  
  5376.  
  5377. // Ensure cart contents update when products are added to the cart via AJAX (place the following in functions.php)
  5378.  
  5379. add_filter('add_to_cart_fragments', 'woocommerce_header_add_to_cart_fragment');
  5380.  
  5381. if ( ! function_exists( 'woocommerce_header_add_to_cart_fragment' ) ) {
  5382.  
  5383. function woocommerce_header_add_to_cart_fragment( $fragments ) {
  5384.  
  5385. global $woocommerce;
  5386.  
  5387.  
  5388.  
  5389. ob_start();
  5390.  
  5391.  
  5392.  
  5393. ?>
  5394.  
  5395. <span class="cart_details"><?php echo sprintf(_n('%d item', '%d items', $woocommerce->cart->cart_contents_count, 'woothemes'), $woocommerce->cart->cart_contents_count);?> <?php _e("Total of",THEMENAME);?> <?php echo $woocommerce->cart->get_cart_total(); ?> <a href="<?php echo $woocommerce->cart->get_cart_url(); ?>" title="<?php _e('View your shopping cart', 'woothemes'); ?>" class="checkout"><?php _e("Checkout",THEMENAME);?> <span class="icon-chevron-right"></span></a></span>
  5396.  
  5397. <?php
  5398.  
  5399.  
  5400.  
  5401. $fragments['span.cart_details'] = ob_get_clean();
  5402.  
  5403.  
  5404.  
  5405. return $fragments;
  5406.  
  5407.  
  5408.  
  5409. }
  5410.  
  5411. }
  5412.  
  5413.  
  5414.  
  5415. /*--------------------------------------------------------------------------------------------------
  5416.  
  5417. Load theme's widgets
  5418.  
  5419. --------------------------------------------------------------------------------------------------*/
  5420.  
  5421.  
  5422.  
  5423. locate_template(array('widgets/widget-blog-categories.php'), true, true);
  5424.  
  5425. locate_template(array('widgets/widget-archive.php'), true, true);
  5426.  
  5427. locate_template(array('widgets/widget-menu.php'), true, true);
  5428.  
  5429. locate_template(array('widgets/widget-twitter.php'), true, true);
  5430.  
  5431. locate_template(array('widgets/widget-contact-details.php'), true, true);
  5432.  
  5433. locate_template(array('widgets/widget-mailchimp.php'), true, true);
  5434.  
  5435. locate_template(array('widgets/widget-tag-cloud.php'), true, true);
  5436.  
  5437. locate_template(array('widgets/widget-latest_posts.php'), true, true);
  5438.  
  5439. locate_template(array('widgets/widget-social_buttons.php'), true, true);
  5440.  
  5441. locate_template(array('widgets/widget-flickr.php'), true, true);
  5442.  
  5443.  
  5444.  
  5445.  
  5446.  
  5447. /*--------------------------------------------------------------------------------------------------
  5448.  
  5449. GET current page URL
  5450.  
  5451. --------------------------------------------------------------------------------------------------*/
  5452.  
  5453. if ( ! function_exists( 'current_page_url' ) ) {
  5454.  
  5455. function current_page_url() {
  5456.  
  5457. $pageURL = 'http';
  5458.  
  5459. if( isset($_SERVER["HTTPS"]) ) {
  5460.  
  5461. if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
  5462.  
  5463. }
  5464.  
  5465. $pageURL .= "://";
  5466.  
  5467. if ($_SERVER["SERVER_PORT"] != "80") {
  5468.  
  5469. $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
  5470.  
  5471. } else {
  5472.  
  5473. $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
  5474.  
  5475. }
  5476.  
  5477. return $pageURL;
  5478.  
  5479. }
  5480.  
  5481. }
  5482.  
  5483.  
  5484.  
  5485. /*--------------------------------------------------------------------------------------------------
  5486.  
  5487. Remove rel attribute from the category list for HTML validation purposes
  5488.  
  5489. --------------------------------------------------------------------------------------------------*/
  5490.  
  5491. if ( ! function_exists( 'remove_category_rel' ) ) {
  5492.  
  5493. function remove_category_rel($result) {
  5494.  
  5495. $result = str_replace('rel="category tag"', '', $result);
  5496.  
  5497. $result = str_replace('rel="category"', '', $result);
  5498.  
  5499. return $result;
  5500.  
  5501. }
  5502.  
  5503. }
  5504.  
  5505. add_filter('the_category', 'remove_category_rel');
  5506.  
  5507. add_filter('wp_list_categories', 'remove_category_rel');
  5508.  
  5509.  
  5510.  
  5511.  
  5512.  
  5513. /*--------------------------------------------------------------------------------------------------
  5514.  
  5515. Blog Excerpt Functions
  5516.  
  5517. --------------------------------------------------------------------------------------------------*/
  5518.  
  5519. if ( ! function_exists( 'custom_excerpt_length' ) ) {
  5520.  
  5521. function custom_excerpt_length( $length ) {
  5522.  
  5523.  
  5524.  
  5525. global $data;
  5526.  
  5527.  
  5528.  
  5529. if ( !empty ( $data['blog_excerpt_limit'] ) ) {
  5530.  
  5531. $excerpt = $data['blog_excerpt_limit'];
  5532.  
  5533. }
  5534.  
  5535. else {
  5536.  
  5537. $excerpt = 55;
  5538.  
  5539. }
  5540.  
  5541.  
  5542.  
  5543. return $excerpt;
  5544.  
  5545. }
  5546.  
  5547. }
  5548.  
  5549.  
  5550.  
  5551. if ( ! function_exists( 'clear_excerpt_more' ) ) {
  5552.  
  5553. function clear_excerpt_more( $more ) {
  5554.  
  5555. return '';
  5556.  
  5557. }
  5558.  
  5559. }
  5560.  
  5561.  
  5562.  
  5563. add_filter('excerpt_more', 'clear_excerpt_more');
  5564.  
  5565. add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
  5566.  
  5567.  
  5568.  
  5569. if ( ! function_exists( 'zn_limit_content' ) ) {
  5570.  
  5571. function zn_limit_content($string, $word_limit)
  5572.  
  5573. {
  5574.  
  5575. $words = explode(" ",$string);
  5576.  
  5577. return implode(" ",array_splice($words,0,$word_limit));
  5578.  
  5579. }
  5580.  
  5581. }
  5582.  
  5583.  
  5584.  
  5585.  
  5586.  
  5587. /*--------------------------------------------------------------------------------------------------
  5588.  
  5589. Pagination Functions
  5590.  
  5591. --------------------------------------------------------------------------------------------------*/
  5592.  
  5593. if ( ! function_exists( 'zn_pagination' ) ) {
  5594.  
  5595. function zn_pagination($pages = '', $range = 2)
  5596.  
  5597. {
  5598.  
  5599. $showitems = ($range * 2)+1;
  5600.  
  5601.  
  5602.  
  5603. global $paged;
  5604.  
  5605. if(empty($paged)) $paged = 1;
  5606.  
  5607.  
  5608.  
  5609. if($pages == '')
  5610.  
  5611. {
  5612.  
  5613. global $wp_query;
  5614.  
  5615. $pages = $wp_query->max_num_pages;
  5616.  
  5617.  
  5618.  
  5619. if(!$pages) { $pages = 1; }
  5620.  
  5621.  
  5622.  
  5623. }
  5624.  
  5625.  
  5626.  
  5627. if(1 != $pages)
  5628.  
  5629. {
  5630.  
  5631. //__( 'Published in', THEMENAME )
  5632.  
  5633. echo "<div class='pagination'>";
  5634.  
  5635. echo '<ul>';
  5636.  
  5637.  
  5638.  
  5639. if(1 == $paged) {
  5640.  
  5641. echo '<li class="pagination-start"><span class="pagenav">'.__( 'Start', THEMENAME ).'</span></li>';
  5642.  
  5643. echo '<li class="pagination-prev"><span class="pagenav">'.__( 'Prev', THEMENAME ).'</span></li>';
  5644.  
  5645. }
  5646.  
  5647. else {
  5648.  
  5649. echo '<li class="pagination-start"><a href="'.get_pagenum_link(1).'">'.__( 'Start', THEMENAME ).'</a></li>';
  5650.  
  5651. echo '<li class="pagination-prev"><a href="'.get_pagenum_link($paged-1).'">'.__( 'Prev', THEMENAME ).'</a></li>';
  5652.  
  5653. }
  5654.  
  5655.  
  5656.  
  5657. for ($i=1; $i <= $pages; $i++)
  5658.  
  5659. {
  5660.  
  5661. if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))
  5662.  
  5663. {
  5664.  
  5665. //echo ($paged == $i)? "<span class='current zn_default_color_active'>".$i."</span>":"<a href='".get_pagenum_link($i)."' class='inactive zn_default_color' >".$i."</a>";
  5666.  
  5667. echo ($paged == $i)? '<li><span class="pagenav">'.$i.'</span></li>':'<li><a href="'.get_pagenum_link($i).'">'.$i.'</a></li>';
  5668.  
  5669. }
  5670.  
  5671. }
  5672.  
  5673.  
  5674.  
  5675. if($paged < $pages ) {
  5676.  
  5677. echo '<li class="pagination-next"><a href="'.get_pagenum_link($paged+1).'">'.__( 'Next', THEMENAME ).'</a></li>';
  5678.  
  5679. echo '<li class="pagination-end"><a href="'.get_pagenum_link($pages).'">'.__( 'End', THEMENAME ).'</a></li>';
  5680.  
  5681. }
  5682.  
  5683. else {
  5684.  
  5685. echo '<li class="pagination-next"><span class="pagenav">'.__( 'Next', THEMENAME ).'</span></li>';
  5686.  
  5687. echo '<li class="pagination-end"><span class="pagenav">'.__( 'End', THEMENAME ).'</span></li>';
  5688.  
  5689. }
  5690.  
  5691.  
  5692.  
  5693. echo '</ul>';
  5694.  
  5695. echo '<div class="clear"></div>';
  5696.  
  5697. echo ''.__( 'Page', THEMENAME ).' '.$paged.' '.__( 'of', THEMENAME ).' '.$pages.'';
  5698.  
  5699. echo "</div>\n";
  5700.  
  5701. }
  5702.  
  5703. }
  5704.  
  5705. }
  5706.  
  5707.  
  5708.  
  5709. /*--------------------------------------------------------------------------------------------------
  5710.  
  5711. Portfolio Post Type
  5712.  
  5713. --------------------------------------------------------------------------------------------------*/
  5714.  
  5715.  
  5716.  
  5717. add_action('init','zn_portfolio_post_type');
  5718.  
  5719. if ( ! function_exists( 'zn_portfolio_post_type' ) ) {
  5720.  
  5721. function zn_portfolio_post_type() {
  5722.  
  5723.  
  5724.  
  5725. $labels = array(
  5726.  
  5727. 'name' => 'Portfolios',
  5728.  
  5729. 'singular_name' => 'Portfolio Item',
  5730.  
  5731. 'add_new' => 'Add New Portfolio Item',
  5732.  
  5733. 'all_items' => 'All Portfolio Items',
  5734.  
  5735. 'add_new_item' => 'Add New Portfolio',
  5736.  
  5737. 'edit_item' => 'Edit Portfolio Item',
  5738.  
  5739. 'new_item' => 'New Portfolio Item',
  5740.  
  5741. 'view_item' => 'View Portfolio Item',
  5742.  
  5743. 'search_items' => 'Search Portfolio Items',
  5744.  
  5745. 'not_found' => 'No Portfolio Items found',
  5746.  
  5747. 'not_found_in_trash' => 'No Portfolio Items found in trash',
  5748.  
  5749. 'parent_item_colon' => 'Parent Portfolio:',
  5750.  
  5751. 'menu_name' => 'Portfolio Items'
  5752.  
  5753. );
  5754.  
  5755.  
  5756.  
  5757. $args = array(
  5758.  
  5759. 'labels' => $labels,
  5760.  
  5761. 'description' => "",
  5762.  
  5763. 'public' => true,
  5764.  
  5765. 'exclude_from_search' => false,
  5766.  
  5767. 'publicly_queryable' => true,
  5768.  
  5769. 'show_ui' => true,
  5770.  
  5771. 'show_in_nav_menus' => true,
  5772.  
  5773. 'show_in_menu' => true,
  5774.  
  5775. 'show_in_admin_bar' => true,
  5776.  
  5777. 'menu_position' => 100,
  5778.  
  5779. 'menu_icon' => ADMIN_IMAGES_DIR.'/portfolio.png',
  5780.  
  5781. 'capability_type' => 'post',
  5782.  
  5783. 'hierarchical' => false,
  5784.  
  5785. 'supports' => array('title','editor'),
  5786.  
  5787. 'has_archive' => true,
  5788.  
  5789. 'rewrite' => true,
  5790.  
  5791. 'query_var' => true,
  5792.  
  5793. 'can_export' => true
  5794.  
  5795. );
  5796.  
  5797.  
  5798.  
  5799. register_post_type('portfolio',$args);
  5800.  
  5801. }
  5802.  
  5803. }
  5804.  
  5805. // Flush Rewrite rules
  5806.  
  5807. if ( ! function_exists( 'zn_rewrite_flush' ) ) {
  5808.  
  5809. function zn_rewrite_flush() {
  5810.  
  5811. flush_rewrite_rules();
  5812.  
  5813. }
  5814.  
  5815. }
  5816.  
  5817.  
  5818.  
  5819. add_action( 'after_switch_theme', 'zn_rewrite_flush' );
  5820.  
  5821.  
  5822.  
  5823. /*--------------------------------------------------------------------------------------------------
  5824.  
  5825. Portfolio Post Taxonomy
  5826.  
  5827. --------------------------------------------------------------------------------------------------*/
  5828.  
  5829.  
  5830.  
  5831. add_action( 'init', 'zn_portfolio_category', 0 );
  5832.  
  5833. if ( ! function_exists( 'zn_portfolio_category' ) ) {
  5834.  
  5835. function zn_portfolio_category()
  5836.  
  5837. {
  5838.  
  5839. // Add new taxonomy, make it hierarchical (like categories)
  5840.  
  5841. $labels = array(
  5842.  
  5843. 'name' => __( 'Categories',THEMENAME),
  5844.  
  5845. 'singular_name' => __( 'Category',THEMENAME ),
  5846.  
  5847. 'search_items' => __( 'Search Categories',THEMENAME ),
  5848.  
  5849. 'all_items' => __( 'All Categories',THEMENAME ),
  5850.  
  5851. 'parent_item' => __( 'Parent Category',THEMENAME ),
  5852.  
  5853. 'parent_item_colon' => __( 'Parent Category:',THEMENAME ),
  5854.  
  5855. 'edit_item' => __( 'Edit Category',THEMENAME ),
  5856.  
  5857. 'update_item' => __( 'Update Category',THEMENAME ),
  5858.  
  5859. 'add_new_item' => __( 'Add New Category',THEMENAME ),
  5860.  
  5861. 'new_item_name' => __( 'New Category Name',THEMENAME ),
  5862.  
  5863. 'menu_name' => __( 'Portfolio categories',THEMENAME ),
  5864.  
  5865. );
  5866.  
  5867.  
  5868.  
  5869. register_taxonomy('project_category','portfolio', array(
  5870.  
  5871. 'hierarchical' => true,
  5872.  
  5873. 'labels' => $labels,
  5874.  
  5875. 'show_ui' => true,
  5876.  
  5877. 'query_var' => true,
  5878.  
  5879. 'rewrite' => true,
  5880.  
  5881. ));
  5882.  
  5883. }
  5884.  
  5885. }
  5886.  
  5887. /*--------------------------------------------------------------------------------------------------
  5888.  
  5889. Breadcrumbs
  5890.  
  5891. --------------------------------------------------------------------------------------------------*/
  5892.  
  5893. if ( ! function_exists( 'zn_breadcrumbs' ) ) {
  5894.  
  5895. function zn_breadcrumbs() {
  5896.  
  5897.  
  5898.  
  5899. $delimiter = '&raquo;';
  5900.  
  5901. $home = __('Home',THEMENAME);
  5902.  
  5903. $showCurrent = 1; // 1 - show current post/page title in breadcrumbs, 0 - don't show
  5904.  
  5905. $before = '<span class="current">'; // tag before the current crumb
  5906.  
  5907. $after = '</span>'; // tag after the current crumb
  5908.  
  5909.  
  5910.  
  5911. if ( get_option('woocommerce_prepend_shop_page_to_urls') == "yes" && woocommerce_get_page_id( 'shop' ) && get_option( 'page_on_front' ) !== woocommerce_get_page_id( 'shop' ) )
  5912.  
  5913. $prepend = '<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . get_permalink( woocommerce_get_page_id('shop') ) . '">' . get_the_title( woocommerce_get_page_id('shop') ) . '</a></li>';
  5914.  
  5915. else
  5916.  
  5917. $prepend = '';
  5918.  
  5919.  
  5920.  
  5921.  
  5922.  
  5923. global $post, $data, $wp_query;
  5924.  
  5925. $homeLink = home_url();
  5926.  
  5927.  
  5928.  
  5929. if ( is_front_page() ) {
  5930.  
  5931.  
  5932.  
  5933. echo '<ul xmlns:v="http://rdf.data-vocabulary.org/#" class="breadcrumbs fixclear"><li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . $homeLink . '">' . $home . '</a></li></ul>';
  5934.  
  5935.  
  5936.  
  5937. }
  5938.  
  5939. elseif ( is_home() ) {
  5940.  
  5941.  
  5942.  
  5943. if ( function_exists ('icl_t') )
  5944.  
  5945. {
  5946.  
  5947. $title = icl_t(THEMENAME, 'Archive Page Title', do_shortcode(stripslashes($data['archive_page_title'])));
  5948.  
  5949. }
  5950.  
  5951. else
  5952.  
  5953. {
  5954.  
  5955. $title = do_shortcode(stripslashes($data['archive_page_title']));
  5956.  
  5957. }
  5958.  
  5959.  
  5960.  
  5961.  
  5962.  
  5963. echo '<ul xmlns:v="http://rdf.data-vocabulary.org/#" class="breadcrumbs fixclear"><li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . $homeLink . '">' . $home . '</a></li><li>'.$title.'</li></ul>';
  5964.  
  5965. }
  5966.  
  5967. else {
  5968.  
  5969.  
  5970.  
  5971. echo '<ul xmlns:v="http://rdf.data-vocabulary.org/#" class="breadcrumbs fixclear"><li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . $homeLink . '">' . $home . '</a></li>';
  5972.  
  5973.  
  5974.  
  5975. if ( is_category() ) {
  5976.  
  5977.  
  5978.  
  5979. $thisCat = get_category(get_query_var('cat'), false);
  5980.  
  5981. if ($thisCat->parent != 0) $cats = get_category_parents($thisCat->parent, TRUE, '|zn_preg|');
  5982.  
  5983.  
  5984.  
  5985. $cats = get_category_parents($thisCat, TRUE, '|zn_preg|');
  5986.  
  5987.  
  5988.  
  5989. $cats = explode ( '|zn_preg|',$cats );
  5990.  
  5991.  
  5992.  
  5993. foreach ( $cats as $s_cat ) {
  5994.  
  5995. if ( !empty ( $s_cat ) ) {
  5996.  
  5997. $s_cat = str_replace ( '<a', '<a rel="v:url" property="v:title" ' , $s_cat );
  5998.  
  5999. echo '<li typeof="v:Breadcrumb">'.$s_cat.'</li>';
  6000.  
  6001. }
  6002.  
  6003. }
  6004.  
  6005.  
  6006.  
  6007. echo '<li>'. __("Archive from category ",THEMENAME).'"' . single_cat_title('', false) . '"</li>';
  6008.  
  6009.  
  6010.  
  6011. }
  6012.  
  6013. elseif ( is_tax('product_cat') ) {
  6014.  
  6015.  
  6016.  
  6017. echo $prepend;
  6018.  
  6019.  
  6020.  
  6021. $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
  6022.  
  6023.  
  6024.  
  6025. $parents = array();
  6026.  
  6027. $parent = $term->parent;
  6028.  
  6029. while ( $parent ) {
  6030.  
  6031. $parents[] = $parent;
  6032.  
  6033. $new_parent = get_term_by( 'id', $parent, get_query_var( 'taxonomy' ) );
  6034.  
  6035. $parent = $new_parent->parent;
  6036.  
  6037. }
  6038.  
  6039.  
  6040.  
  6041. if ( ! empty( $parents ) ) {
  6042.  
  6043. $parents = array_reverse( $parents );
  6044.  
  6045. foreach ( $parents as $parent ) {
  6046.  
  6047. $item = get_term_by( 'id', $parent, get_query_var( 'taxonomy' ));
  6048.  
  6049. echo '<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . get_term_link( $item->slug, 'product_cat' ) . '">' . $item->name . '</a></li>';
  6050.  
  6051. }
  6052.  
  6053. }
  6054.  
  6055.  
  6056.  
  6057. $queried_object = $wp_query->get_queried_object();
  6058.  
  6059. echo '<li>'. $queried_object->name . '</li>';
  6060.  
  6061.  
  6062.  
  6063. }
  6064.  
  6065. elseif ( is_tax('project_category') ) {
  6066.  
  6067.  
  6068.  
  6069. $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
  6070.  
  6071.  
  6072.  
  6073. $parents = array();
  6074.  
  6075. $parent = $term->parent;
  6076.  
  6077. while ( $parent ) {
  6078.  
  6079. $parents[] = $parent;
  6080.  
  6081. $new_parent = get_term_by( 'id', $parent, get_query_var( 'taxonomy' ) );
  6082.  
  6083. $parent = $new_parent->parent;
  6084.  
  6085. }
  6086.  
  6087.  
  6088.  
  6089. if ( ! empty( $parents ) ) {
  6090.  
  6091. $parents = array_reverse( $parents );
  6092.  
  6093. foreach ( $parents as $parent ) {
  6094.  
  6095. $item = get_term_by( 'id', $parent, get_query_var( 'taxonomy' ));
  6096.  
  6097. echo '<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . get_term_link( $item->slug, 'product_cat' ) . '">' . $item->name . '</a></li>';
  6098.  
  6099. }
  6100.  
  6101. }
  6102.  
  6103.  
  6104.  
  6105. $queried_object = $wp_query->get_queried_object();
  6106.  
  6107. echo '<li>'. $queried_object->name . '</li>';
  6108.  
  6109.  
  6110.  
  6111. }
  6112.  
  6113. elseif ( is_tax('documentation_category') ) {
  6114.  
  6115.  
  6116.  
  6117. $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
  6118.  
  6119.  
  6120.  
  6121. $parents = array();
  6122.  
  6123. $parent = $term->parent;
  6124.  
  6125. while ( $parent ) {
  6126.  
  6127. $parents[] = $parent;
  6128.  
  6129. $new_parent = get_term_by( 'id', $parent, get_query_var( 'taxonomy' ) );
  6130.  
  6131. $parent = $new_parent->parent;
  6132.  
  6133. }
  6134.  
  6135.  
  6136.  
  6137. if ( ! empty( $parents ) ) {
  6138.  
  6139. $parents = array_reverse( $parents );
  6140.  
  6141. foreach ( $parents as $parent ) {
  6142.  
  6143. $item = get_term_by( 'id', $parent, get_query_var( 'taxonomy' ));
  6144.  
  6145. echo '<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . get_term_link( $item->slug, 'documentation_category' ) . '">' . $item->name . '</a></li>';
  6146.  
  6147. }
  6148.  
  6149. }
  6150.  
  6151.  
  6152.  
  6153. $queried_object = $wp_query->get_queried_object();
  6154.  
  6155. echo '<li>'. $queried_object->name . '</li>';
  6156.  
  6157.  
  6158.  
  6159. }
  6160.  
  6161. elseif ( is_search() ) {
  6162.  
  6163. echo '<li>'. __("Search results for ",THEMENAME).'"' . get_search_query() . '"</li>';
  6164.  
  6165.  
  6166.  
  6167. } elseif ( is_day() ) {
  6168.  
  6169. echo '<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a></li>';
  6170.  
  6171. echo '<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . get_month_link(get_the_time('Y'),get_the_time('m')) . '">' . get_the_time('F') . '</a></li>';
  6172.  
  6173. echo '<li>'.get_the_time('d').'</li>';
  6174.  
  6175.  
  6176.  
  6177. } elseif ( is_month() ) {
  6178.  
  6179. echo '<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a></li>';
  6180.  
  6181. echo '<li>'.get_the_time('F').'</li>';
  6182.  
  6183.  
  6184.  
  6185. } elseif ( is_year() ) {
  6186.  
  6187. echo '<li>'.get_the_time('Y').'</li>';
  6188.  
  6189. }
  6190.  
  6191. elseif ( is_post_type_archive('product') && get_option('page_on_front') !== woocommerce_get_page_id('shop') ) {
  6192.  
  6193.  
  6194.  
  6195. $_name = woocommerce_get_page_id( 'shop' ) ? get_the_title( woocommerce_get_page_id( 'shop' ) ) : ucwords( get_option( 'woocommerce_shop_slug' ) );
  6196.  
  6197.  
  6198.  
  6199. if ( is_search() ) {
  6200.  
  6201.  
  6202.  
  6203. echo '<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . get_post_type_archive_link('product') . '">' . $_name . '</a></li><li>'. __('Search results for &ldquo;', 'woocommerce') . get_search_query() . '</li>';
  6204.  
  6205.  
  6206.  
  6207. } elseif ( is_paged() ) {
  6208.  
  6209.  
  6210.  
  6211. echo '<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . get_post_type_archive_link('product') . '">' . $_name . '</a></li>';
  6212.  
  6213.  
  6214.  
  6215. } else {
  6216.  
  6217.  
  6218.  
  6219. echo '<li>' . $_name . '</li>';
  6220.  
  6221.  
  6222.  
  6223. }
  6224.  
  6225.  
  6226.  
  6227. }
  6228.  
  6229. elseif ( is_single() && !is_attachment() ) {
  6230.  
  6231. if ( get_post_type() == 'portfolio' ) {
  6232.  
  6233.  
  6234.  
  6235. // Show category name
  6236.  
  6237. $cats = get_the_term_list($post->ID, 'project_category', ' ', '|zn_preg|', '|zn_preg|');
  6238.  
  6239. $cats = explode ( '|zn_preg|',$cats );
  6240.  
  6241.  
  6242.  
  6243. $terms = get_the_terms( $post->ID, 'project_category' );
  6244.  
  6245. foreach($terms as $term){
  6246.  
  6247. if ( $term->parent != 0 ) {
  6248.  
  6249. $terms[$term->parent]->child = $term;
  6250.  
  6251. } else {
  6252.  
  6253. $parent = $term;
  6254.  
  6255. }
  6256.  
  6257. }
  6258.  
  6259. foreach($cats as $cat){
  6260.  
  6261. if(strpos($cat, $parent->name)){
  6262.  
  6263. $s_cat = str_replace ( '<a', '<a rel="v:url" property="v:title" ' , $cat );
  6264.  
  6265. $s_cat = str_replace ( '/project_category', '' , $cat );
  6266.  
  6267. echo '<li typeof="v:Breadcrumb">'.$s_cat.'</li>';
  6268.  
  6269. }
  6270.  
  6271. }
  6272.  
  6273. foreach($cats as $cat){
  6274.  
  6275. if(strpos($cat, $parent->child->name)){
  6276.  
  6277. $s_cat = str_replace ( '<a', '<a rel="v:url" property="v:title" ' , $cat );
  6278.  
  6279. echo '<li typeof="v:Breadcrumb">'.$s_cat.'</li>';
  6280.  
  6281. }
  6282.  
  6283. }
  6284.  
  6285. foreach($cats as $cat){
  6286.  
  6287. echo $parent->child->child->name;
  6288.  
  6289. if(strpos($cat, $parent->child->child->name)){
  6290.  
  6291. $s_cat = str_replace ( '<a', '<a rel="v:url" property="v:title" ' , $cat );
  6292.  
  6293. echo '<li typeof="v:Breadcrumb">'.$s_cat.'</li>';
  6294.  
  6295. }
  6296.  
  6297. }
  6298.  
  6299. //CHANGE PER CBCONLIN TO SHOW FULL BREADCRUMB TRAIL - JP
  6300.  
  6301. //if ( !empty ( $cats['0'] ) ) {
  6302.  
  6303.  
  6304.  
  6305. // $s_cat = str_replace ( '<a', '<a rel="v:url" property="v:title" ' , $cats['0'] );
  6306.  
  6307. // echo '<li typeof="v:Breadcrumb">isSingle'.$s_cat.'</li>';
  6308.  
  6309. //}
  6310.  
  6311.  
  6312.  
  6313. // Show post name
  6314.  
  6315. echo '<li>' . get_the_title() . '</li>';
  6316.  
  6317. }
  6318.  
  6319. elseif ( get_post_type() == 'product' ) {
  6320.  
  6321.  
  6322.  
  6323. echo $prepend;
  6324.  
  6325.  
  6326.  
  6327. if ( $terms = wp_get_object_terms( $post->ID, 'product_cat' ) ) {
  6328.  
  6329. $term = current( $terms );
  6330.  
  6331. $parents = array();
  6332.  
  6333. $parent = $term->parent;
  6334.  
  6335.  
  6336.  
  6337. while ( $parent ) {
  6338.  
  6339. $parents[] = $parent;
  6340.  
  6341. $new_parent = get_term_by( 'id', $parent, 'product_cat' );
  6342.  
  6343. $parent = $new_parent->parent;
  6344.  
  6345. }
  6346.  
  6347.  
  6348.  
  6349. if ( ! empty( $parents ) ) {
  6350.  
  6351. $parents = array_reverse($parents);
  6352.  
  6353. foreach ( $parents as $parent ) {
  6354.  
  6355. $item = get_term_by( 'id', $parent, 'product_cat');
  6356.  
  6357. echo '<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . get_term_link( $item->slug, 'product_cat' ) . '">' . $item->name . '</a></li>';
  6358.  
  6359. }
  6360.  
  6361. }
  6362.  
  6363.  
  6364.  
  6365. echo '<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . get_term_link( $term->slug, 'product_cat' ) . '">' . $term->name . '</a></li>';
  6366.  
  6367.  
  6368.  
  6369. }
  6370.  
  6371.  
  6372.  
  6373. echo '<li>'. get_the_title() . '</li>';
  6374.  
  6375.  
  6376.  
  6377. }
  6378.  
  6379. elseif ( get_post_type() != 'post' ) {
  6380.  
  6381. $post_type = get_post_type_object(get_post_type());
  6382.  
  6383. $slug = $post_type->rewrite;
  6384.  
  6385. //print_r($slug);
  6386.  
  6387. echo '<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . $homeLink . '/' . $slug['slug'] . '/">' . $post_type->labels->singular_name . '</a></li>';
  6388.  
  6389. if ($showCurrent == 1) echo '<li>'.get_the_title().'</li>';
  6390.  
  6391. } else {
  6392.  
  6393.  
  6394.  
  6395.  
  6396.  
  6397. // Show category name
  6398.  
  6399. $cat = get_the_category(); $cat = $cat[0];
  6400.  
  6401. $cats = get_category_parents($cat, TRUE, '|zn_preg|');
  6402.  
  6403.  
  6404.  
  6405. $cats = explode ( '|zn_preg|',$cats );
  6406.  
  6407. foreach ( $cats as $s_cat ) {
  6408.  
  6409. if ( !empty ( $s_cat ) ) {
  6410.  
  6411. $s_cat = str_replace ( '<a', '<a rel="v:url" property="v:title" ' , $s_cat );
  6412.  
  6413. echo '<li typeof="v:Breadcrumb">'.$s_cat.'</li>';
  6414.  
  6415. }
  6416.  
  6417. }
  6418.  
  6419. // Show post name
  6420.  
  6421. echo '<li>' . get_the_title() . '</li>';
  6422.  
  6423. }
  6424.  
  6425.  
  6426.  
  6427. } elseif ( !is_single() && !is_page() && get_post_type() != 'post' && !is_404() ) {
  6428.  
  6429. $post_type = get_post_type_object(get_post_type());
  6430.  
  6431. if ( !empty ( $post_type->labels->singular_name ) ) {
  6432.  
  6433. echo '<li>'.$post_type->labels->singular_name . '</li>';
  6434.  
  6435. }
  6436.  
  6437.  
  6438.  
  6439. } elseif ( is_attachment() ) {
  6440.  
  6441. $parent = get_post($post->post_parent);
  6442.  
  6443. //print_r($parent);
  6444.  
  6445.  
  6446.  
  6447. $cat = get_the_category($parent->ID);
  6448.  
  6449. if ( !empty($cat) ) {
  6450.  
  6451. $cat = $cat[0];
  6452.  
  6453. echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' ');
  6454.  
  6455. echo '<a href="' . get_permalink($parent) . '">' . $parent->post_title . '</a>';
  6456.  
  6457. echo '<li>' . get_the_title() .'</li>';
  6458.  
  6459. }
  6460.  
  6461. else {
  6462.  
  6463. echo '<li>' . get_the_title() .'</li>';
  6464.  
  6465. }
  6466.  
  6467.  
  6468.  
  6469. } elseif ( is_page() && !is_subpage() ) {
  6470.  
  6471. if ($showCurrent == 1) echo '<li>'. get_the_title() . '</li>';
  6472.  
  6473.  
  6474.  
  6475. } elseif ( is_page() && is_subpage() ) {
  6476.  
  6477. $parent_id = $post->post_parent;
  6478.  
  6479. $breadcrumbs = array();
  6480.  
  6481. while ($parent_id) {
  6482.  
  6483. $page = get_page($parent_id);
  6484.  
  6485. $breadcrumbs[] = '<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . get_permalink($page->ID) . '">' . get_the_title($page->ID) . '</a></li>';
  6486.  
  6487. $parent_id = $page->post_parent;
  6488.  
  6489. }
  6490.  
  6491. $breadcrumbs = array_reverse($breadcrumbs);
  6492.  
  6493. for ($i = 0; $i < count($breadcrumbs); $i++) {
  6494.  
  6495. echo $breadcrumbs[$i];
  6496.  
  6497. //if ($i != count($breadcrumbs)-1) echo ' ' . $delimiter . ' ';
  6498.  
  6499. }
  6500.  
  6501. if ($showCurrent == 1) echo '<li>' . get_the_title() . '</li>';
  6502.  
  6503.  
  6504.  
  6505. } elseif ( is_tag() ) {
  6506.  
  6507. echo '<li>'. __("Posts tagged ",THEMENAME).'"'.single_tag_title('', false).'"</li>';
  6508.  
  6509.  
  6510.  
  6511.  
  6512.  
  6513. } elseif ( is_author() ) {
  6514.  
  6515. global $author;
  6516.  
  6517. $userdata = get_userdata($author);
  6518.  
  6519. echo '<li>'. __("Articles posted by ",THEMENAME) . $userdata->display_name .'</li>';
  6520.  
  6521.  
  6522.  
  6523. } elseif ( is_404() ) {
  6524.  
  6525. echo '<li>'. __("Error 404 ",THEMENAME) .'</li>';
  6526.  
  6527. }
  6528.  
  6529.  
  6530.  
  6531. if ( get_query_var('paged') ) {
  6532.  
  6533. if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ' (';
  6534.  
  6535. echo '<li>'.__('Page',THEMENAME) . ' ' . get_query_var('paged').'</li>';
  6536.  
  6537. if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ')';
  6538.  
  6539. }
  6540.  
  6541.  
  6542.  
  6543. echo '</ul>';
  6544.  
  6545.  
  6546.  
  6547. }
  6548.  
  6549. }
  6550.  
  6551. }
  6552.  
  6553. /*--------------------------------------------------------------------------------------------------
  6554.  
  6555. Check if this is a subpage
  6556.  
  6557. --------------------------------------------------------------------------------------------------*/
  6558.  
  6559. if ( ! function_exists( 'is_subpage' ) ) {
  6560.  
  6561. function is_subpage() {
  6562.  
  6563. global $post; // load details about this page
  6564.  
  6565.  
  6566.  
  6567. if ( is_page() && $post->post_parent ) { // test to see if the page has a parent
  6568.  
  6569. return $post->post_parent; // return the ID of the parent post
  6570.  
  6571.  
  6572.  
  6573. } else { // there is no parent so ...
  6574.  
  6575. return false; // ... the answer to the question is false
  6576.  
  6577. }
  6578.  
  6579. }
  6580.  
  6581. }
  6582.  
  6583.  
  6584.  
  6585.  
  6586.  
  6587. /*--------------------------------------------------------------------------------------------------
  6588.  
  6589. Login Form
  6590.  
  6591. --------------------------------------------------------------------------------------------------*/
  6592.  
  6593. if ( ! function_exists( 'zn_login_form' ) ) {
  6594.  
  6595. function zn_login_form () {
  6596.  
  6597. // CHECK IF USER IS LOGGED IN
  6598.  
  6599. global $data;
  6600.  
  6601. if ( is_user_logged_in() || !$data['head_show_login'] ) {
  6602.  
  6603. return '';
  6604.  
  6605. }
  6606.  
  6607. ?>
  6608.  
  6609.  
  6610.  
  6611. <div class="login_register_stuff hide"><!-- Login/Register Modal forms - hidded by default to be opened through modal -->
  6612.  
  6613. <div id="login_panel">
  6614.  
  6615. <div class="inner-container login-panel">
  6616.  
  6617. <?php // wp_login_form( ); ?>
  6618.  
  6619. <h3 class="m_title"><?php _e("SIGN IN YOUR ACCOUNT TO HAVE ACCESS TO DIFFERENT FEATURES",THEMENAME);?></h3>
  6620.  
  6621.  
  6622.  
  6623. <form id="login_form" name="login_form" method="post" class="zn_form_login" action="<?php echo site_url('wp-login.php', 'login_post') ?>">
  6624.  
  6625.  
  6626.  
  6627. <?php if( get_option('users_can_register') ) { ?>
  6628.  
  6629. <a href="#" class="create_account" onClick="ppOpen('#register_panel', '280');"><?php _e("CREATE ACCOUNT",THEMENAME);?></a>
  6630.  
  6631. <?php } ?>
  6632.  
  6633.  
  6634.  
  6635. <input type="text" id="username" name="log" class="inputbox" placeholder="<?php _e("Username",THEMENAME);?>">
  6636.  
  6637. <input type="password" id="password" name="pwd" class="inputbox" placeholder="<?php _e("Password",THEMENAME);?>">
  6638.  
  6639. <?php do_action('login_form');?>
  6640.  
  6641. <label class="zn_remember"><input type="checkbox" name="rememberme" id="rememberme" value="forever"><?php _e(" Remember Me",THEMENAME);?></label>
  6642.  
  6643. <input type="submit" id="login" name="submit_button" class="zn_sub_button" value="<?php _e("LOG IN",THEMENAME);?>">
  6644.  
  6645. <input type="hidden" value="login" class="" name="zn_form_action">
  6646.  
  6647. <input type="hidden" value="zn_do_login" class="" name="action">
  6648.  
  6649. <input type="hidden" value="<?php echo $_SERVER['PHP_SELF'] ?>" class="zn_login_redirect" name="submit">
  6650.  
  6651. <div class="links"><a href="#" onClick="ppOpen('#forgot_panel', '350');"><?php _e("FORGOT YOUR PASSWORD?",THEMENAME);?></a></div>
  6652.  
  6653. </form>
  6654.  
  6655.  
  6656.  
  6657. </div>
  6658.  
  6659. </div><!-- end login panel -->
  6660.  
  6661.  
  6662.  
  6663. <?php if( get_option('users_can_register') ) { ?>
  6664.  
  6665. <div id="register_panel">
  6666.  
  6667. <div class="inner-container register-panel">
  6668.  
  6669. <h3 class="m_title"><?php _e("CREATE ACCOUNT",THEMENAME);?></h3>
  6670.  
  6671. <form id="register_form" name="login_form" method="post" class="zn_form_login" action="<?php echo site_url('wp-login.php?action=register', 'login_post') ?>">
  6672.  
  6673. <p>
  6674.  
  6675. <input type="text" id="reg-username" name="user_login" class="inputbox" placeholder="<?php _e("Username",THEMENAME);?>">
  6676.  
  6677. </p>
  6678.  
  6679. <p>
  6680.  
  6681. <input type="text" id="reg-email" name="user_email" class="inputbox" placeholder="<?php _e("Your email",THEMENAME);?>">
  6682.  
  6683. </p>
  6684.  
  6685. <p>
  6686.  
  6687. <input type="text" id="reg-pass" name="user_password" class="inputbox" placeholder="<?php _e("Your password",THEMENAME);?>">
  6688.  
  6689. </p>
  6690.  
  6691. <p>
  6692.  
  6693. <input type="text" id="reg-pass" name="user_password2" class="inputbox" placeholder="<?php _e("Verify password",THEMENAME);?>">
  6694.  
  6695. </p>
  6696.  
  6697. <p>
  6698.  
  6699. <input type="submit" id="signup" name="submit" class="zn_sub_button" value="<?php _e("CREATE MY ACCOUNT",THEMENAME);?>">
  6700.  
  6701. </p>
  6702.  
  6703. <input type="hidden" value="register" class="" name="zn_form_action">
  6704.  
  6705. <input type="hidden" value="zn_do_login" class="" name="action">
  6706.  
  6707. <input type="hidden" value="<?php echo $_SERVER['PHP_SELF'] ?>" class="zn_login_redirect" name="submit">
  6708.  
  6709. <div class="links"><a href="#" onClick="ppOpen('#login_panel', '800');"><?php _e("ALREADY HAVE AN ACCOUNT?",THEMENAME);?></a></div>
  6710.  
  6711. </form>
  6712.  
  6713.  
  6714.  
  6715. </div>
  6716.  
  6717. </div><!-- end register panel -->
  6718.  
  6719. <?php } ?>
  6720.  
  6721.  
  6722.  
  6723. <div id="forgot_panel">
  6724.  
  6725. <div class="inner-container forgot-panel">
  6726.  
  6727. <h3 class="m_title"><?php _e("FORGOT YOUR DETAILS?",THEMENAME);?></h3>
  6728.  
  6729. <form id="forgot_form" name="login_form" method="post" class="zn_form_lost_pass" action="<?php echo site_url('wp-login.php?action=lostpassword', 'login_post') ?>">
  6730.  
  6731. <p>
  6732.  
  6733. <input type="text" id="forgot-email" name="user_login" class="inputbox" placeholder="<?php _e("Username or E-mail",THEMENAME);?>">
  6734.  
  6735. </p>
  6736.  
  6737. <p>
  6738.  
  6739. <input type="submit" id="recover" name="submit" class="zn_sub_button" value="<?php _e("SEND MY DETAILS!",THEMENAME);?>">
  6740.  
  6741. </p>
  6742.  
  6743. <div class="links"><a href="#" onClick="ppOpen('#login_panel', '800');"><?php _e("AAH, WAIT, I REMEMBER NOW!",THEMENAME);?></a></div>
  6744.  
  6745. </form>
  6746.  
  6747.  
  6748.  
  6749. </div>
  6750.  
  6751. </div><!-- end register panel -->
  6752.  
  6753. </div><!-- end login register stuff -->
  6754.  
  6755.  
  6756.  
  6757. <?php
  6758.  
  6759.  
  6760.  
  6761.  
  6762.  
  6763. }
  6764.  
  6765. }
  6766.  
  6767.  
  6768.  
  6769.  
  6770.  
  6771.  
  6772.  
  6773. /*--------------------------------------------------------------------------------------------------
  6774.  
  6775. Login Form - Stop redirecting if ajax is used
  6776.  
  6777. --------------------------------------------------------------------------------------------------*/
  6778.  
  6779. if ( ! function_exists( 'zn_stop_redirecting' ) ) {
  6780.  
  6781. function zn_stop_redirecting($redirect_to, $request,$user) {
  6782.  
  6783. if(!empty ( $_POST['ajax_login'] ) ) {
  6784.  
  6785. return;
  6786.  
  6787. }
  6788.  
  6789. else {
  6790.  
  6791. return $redirect_to;
  6792.  
  6793. }
  6794.  
  6795. }
  6796.  
  6797. }
  6798.  
  6799. add_filter("login_redirect", "zn_stop_redirecting", 10, 3);
  6800.  
  6801.  
  6802.  
  6803. /*--------------------------------------------------------------------------------------------------
  6804.  
  6805. New User registration EMAIL
  6806.  
  6807. --------------------------------------------------------------------------------------------------*/
  6808.  
  6809. /*
  6810.  
  6811. if ( !function_exists('wp_new_user_notification') ) {
  6812.  
  6813. function wp_new_user_notification($user_id, $plaintext_pass) {
  6814.  
  6815. $user = new WP_User($user_id);
  6816.  
  6817.  
  6818.  
  6819. $user_login = stripslashes($user->user_login);
  6820.  
  6821. $user_email = stripslashes($user->user_email);
  6822.  
  6823.  
  6824.  
  6825. $email_subject = "Welcome to ".get_bloginfo('name')." ".$user_login."!";
  6826.  
  6827.  
  6828.  
  6829. ob_start();
  6830.  
  6831.  
  6832.  
  6833. include("email_header.php");
  6834.  
  6835.  
  6836.  
  6837. ?>
  6838.  
  6839.  
  6840.  
  6841. <p><?php _e("A very special welcome to you, ",THEMENAME);?><?php echo $user_login ?>. <?php _e("Thank you for joining , ",THEMENAME); echo get_bloginfo('name');?></p>
  6842.  
  6843.  
  6844.  
  6845. <p>
  6846.  
  6847. <?php _e("Your password is ",THEMENAME);?> <strong style="color:orange"><?php echo $plaintext_pass ?></strong> <br>
  6848.  
  6849. <?php _e("Please keep it secret and keep it safe!",THEMENAME);?>
  6850.  
  6851. </p>
  6852.  
  6853.  
  6854.  
  6855. <p>
  6856.  
  6857. <?php _e("We hope you enjoy your stay at MyAwesomeSite.com. If you have any problems, questions, opinions, praise,
  6858.  
  6859. comments, suggestions, please feel free to contact us at any time",THEMENAME);?>
  6860.  
  6861. </p>
  6862.  
  6863.  
  6864.  
  6865.  
  6866.  
  6867. <?php
  6868.  
  6869. include("email_footer.php");
  6870.  
  6871.  
  6872.  
  6873. $message = ob_get_contents();
  6874.  
  6875. ob_end_clean();
  6876.  
  6877.  
  6878.  
  6879. wp_mail($user_email, $email_subject, $message);
  6880.  
  6881.  
  6882.  
  6883. }
  6884.  
  6885. }
  6886.  
  6887.  
  6888.  
  6889. */
  6890.  
  6891.  
  6892.  
  6893.  
  6894.  
  6895. /*--------------------------------------------------------------------------------------------------
  6896.  
  6897. Facebook Open Graph functions
  6898.  
  6899. --------------------------------------------------------------------------------------------------*/
  6900.  
  6901. /* DEFAULT TITLE*/
  6902.  
  6903. if ( ! function_exists( 'zn_opengraph_default_title' ) ) {
  6904.  
  6905. function zn_opengraph_default_title() {
  6906.  
  6907.  
  6908.  
  6909. $title = wp_title('');
  6910.  
  6911.  
  6912.  
  6913. if ( is_singular() ) {
  6914.  
  6915. $post = get_queried_object();
  6916.  
  6917. if ( isset($post->post_title) ) {
  6918.  
  6919. $title = $post->post_title;
  6920.  
  6921. }
  6922.  
  6923. } else if ( is_author() ) {
  6924.  
  6925. $author = get_queried_object();
  6926.  
  6927. $title = $author->display_name;
  6928.  
  6929. }
  6930.  
  6931.  
  6932.  
  6933. echo $title;
  6934.  
  6935. }
  6936.  
  6937. }
  6938.  
  6939. if ( ! function_exists( 'zn_opengraph_default_type' ) ) {
  6940.  
  6941. function zn_opengraph_default_type() {
  6942.  
  6943.  
  6944.  
  6945. if ( is_singular( array('post', 'page', 'aside', 'status') ) ) {
  6946.  
  6947. $type = 'article';
  6948.  
  6949. } else if ( is_author() ) {
  6950.  
  6951. $type = 'profile';
  6952.  
  6953. } else {
  6954.  
  6955. $type = 'blog';
  6956.  
  6957. }
  6958.  
  6959.  
  6960.  
  6961. echo $type;
  6962.  
  6963. }
  6964.  
  6965. }
  6966.  
  6967.  
  6968.  
  6969. if ( ! function_exists( 'opengraph_default_image' ) ) {
  6970.  
  6971. function opengraph_default_image( ) {
  6972.  
  6973. $image = array();
  6974.  
  6975. if ( is_singular() ) {
  6976.  
  6977. $id = get_queried_object_id();
  6978.  
  6979. $image_ids = array();
  6980.  
  6981.  
  6982.  
  6983. // list post thumbnail first if this post has one
  6984.  
  6985. if ( function_exists('has_post_thumbnail') ) {
  6986.  
  6987. if ( is_singular() && has_post_thumbnail($id) ) {
  6988.  
  6989. $image_ids[] = get_post_thumbnail_id($id);
  6990.  
  6991. }
  6992.  
  6993. }
  6994.  
  6995.  
  6996.  
  6997. // then list any image attachments
  6998.  
  6999. $attachments = get_children( array('post_parent' => $id, 'post_status' => 'inherit',
  7000.  
  7001. 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC',
  7002.  
  7003. 'orderby' => 'menu_order ID') );
  7004.  
  7005. foreach($attachments as $attachment) {
  7006.  
  7007. if ( !in_array($attachment->ID, $image_ids) ) {
  7008.  
  7009. $image_ids[] = $attachment->ID;
  7010.  
  7011. }
  7012.  
  7013. }
  7014.  
  7015.  
  7016.  
  7017. // get URLs for each image
  7018.  
  7019.  
  7020.  
  7021. foreach($image_ids as $id) {
  7022.  
  7023. $thumbnail = wp_get_attachment_image_src( $id, 'medium');
  7024.  
  7025. if ($thumbnail) {
  7026.  
  7027. $image[] = $thumbnail[0];
  7028.  
  7029. }
  7030.  
  7031. }
  7032.  
  7033. }
  7034.  
  7035.  
  7036.  
  7037. foreach ($image as $key => $value) {
  7038.  
  7039. echo '<meta property="og:image" content="'.$value.'"/>';
  7040.  
  7041. }
  7042.  
  7043.  
  7044.  
  7045. }
  7046.  
  7047. }
  7048.  
  7049.  
  7050.  
  7051.  
  7052.  
  7053. /*--------------------------------------------------------------------------------------------------
  7054.  
  7055. CHECK FOR IS COMING SOON PAGE
  7056.  
  7057. --------------------------------------------------------------------------------------------------*/
  7058.  
  7059. if ( ! function_exists( 'zn_coming_soon_page' ) ) {
  7060.  
  7061. function zn_coming_soon_page() {
  7062.  
  7063.  
  7064.  
  7065. global $data,$pagenow;
  7066.  
  7067.  
  7068.  
  7069. if ( $data['cs_enable'] == 'yes' && !is_user_logged_in() && !is_admin() && $pagenow != 'wp-login.php' )
  7070.  
  7071. {
  7072.  
  7073. get_template_part('coming_soon_page');
  7074.  
  7075. exit();
  7076.  
  7077. }
  7078.  
  7079.  
  7080.  
  7081. }
  7082.  
  7083. }
  7084.  
  7085.  
  7086.  
  7087. add_action('init', 'zn_coming_soon_page',26);
  7088.  
  7089.  
  7090.  
  7091.  
  7092.  
  7093. /*--------------------------------------------------------------------------------------------------
  7094.  
  7095. Add Ajax status to page
  7096.  
  7097. --------------------------------------------------------------------------------------------------*/
  7098.  
  7099.  
  7100.  
  7101. if ( ! function_exists( 'zn_has_ajax' ) ) {
  7102.  
  7103. function zn_has_ajax() {
  7104.  
  7105. global $has_ajax;
  7106.  
  7107. if ( isset ($_POST['cform_submit']) ) {
  7108.  
  7109.  
  7110.  
  7111.  
  7112.  
  7113. global $post;
  7114.  
  7115. global $data;
  7116.  
  7117.  
  7118.  
  7119. if ( $post ) {
  7120.  
  7121.  
  7122.  
  7123. $meta_fields = get_post_meta($post->ID, 'zn_meta_elements', true);
  7124.  
  7125. $meta_fields = maybe_unserialize( $meta_fields );
  7126.  
  7127.  
  7128.  
  7129. // All the page builder areas
  7130.  
  7131. $areas = array ( 'header_area' , 'action_box_area' , 'content_main_area', 'content_grey_area' , 'content_bottom_area');
  7132.  
  7133. $metas = array();
  7134.  
  7135.  
  7136.  
  7137. foreach ( $areas as $area ) {
  7138.  
  7139. if ( isset ( $meta_fields[$area] ) ) {
  7140.  
  7141. $metas = array_merge ( $metas , $meta_fields[$area] );
  7142.  
  7143. }
  7144.  
  7145. }
  7146.  
  7147.  
  7148.  
  7149.  
  7150.  
  7151. foreach ($metas as $options )
  7152.  
  7153. {
  7154.  
  7155. // CONTACT FORM
  7156.  
  7157. if ( $options['dynamic_element_type'] == '_c_form' ) {
  7158.  
  7159. if ( isset ($_POST['cform_submit']) ) {
  7160.  
  7161.  
  7162.  
  7163. $body = '';
  7164.  
  7165. $name = '';
  7166.  
  7167. $email = '';
  7168.  
  7169. $headers = "MIME-Version: 1.0\r\nContent-type: text/html; charset=utf-8\r\n";
  7170.  
  7171.  
  7172.  
  7173. foreach ( $options['zn_cf_fields'] as $field ) {
  7174.  
  7175.  
  7176.  
  7177. // Compoese the mail
  7178.  
  7179. if ( isset ( $_POST[str_replace(' ', '_', $field['zn_cf_name'])] ) ) {
  7180.  
  7181.  
  7182.  
  7183. $body .= $field['zn_cf_name'] .' : '.$_POST[$field['zn_cf_name']] ."<br />" ;
  7184.  
  7185. if ( $field['zn_cf_f_email'] ) {
  7186.  
  7187. $email = $_POST[$field['zn_cf_name']];
  7188.  
  7189. }
  7190.  
  7191. if ( $field['zn_cf_f_name'] ) {
  7192.  
  7193. $name = $_POST[$field['zn_cf_name']];
  7194.  
  7195. }
  7196.  
  7197. }
  7198.  
  7199.  
  7200.  
  7201. }
  7202.  
  7203.  
  7204.  
  7205. if ( !empty ( $name ) ) {
  7206.  
  7207. $headers .= "From: \"" . $name . "\" \r\n";
  7208.  
  7209. }
  7210.  
  7211. if ( !empty ( $email ) ) {
  7212.  
  7213. $headers .= "Reply-To: " . $email . "\r\n";
  7214.  
  7215. }
  7216.  
  7217.  
  7218.  
  7219. if ( mail ($options['zn_cf_email_address'],$options['zn_cf_button_subject'],$body,$headers) ){
  7220.  
  7221. echo 'sent';
  7222.  
  7223. }
  7224.  
  7225. else {
  7226.  
  7227. echo 'mail_not_sent';
  7228.  
  7229. }
  7230.  
  7231.  
  7232.  
  7233. }
  7234.  
  7235. }
  7236.  
  7237.  
  7238.  
  7239. }
  7240.  
  7241.  
  7242.  
  7243. }
  7244.  
  7245.  
  7246.  
  7247.  
  7248.  
  7249. //wp_enqueue_scripts();
  7250.  
  7251. exit();
  7252.  
  7253. }
  7254.  
  7255. }
  7256.  
  7257. }
  7258.  
  7259. add_action('get_header', 'zn_has_ajax');
  7260.  
  7261.  
  7262.  
  7263.  
  7264.  
  7265. /*--------------------------------------------------------------------------------------------------
  7266.  
  7267. *
  7268.  
  7269. THEME UPDATE 1.1
  7270.  
  7271. 1.1 - Added new menu position for the header
  7272.  
  7273. *
  7274.  
  7275. --------------------------------------------------------------------------------------------------*/
  7276.  
  7277.  
  7278.  
  7279. /*--------------------------------------------------------------------------------------------------
  7280.  
  7281. New TOP NAVIGATION
  7282.  
  7283. --------------------------------------------------------------------------------------------------*/
  7284.  
  7285. add_action( 'init', 'zn_register_menu2' );
  7286.  
  7287. if ( ! function_exists( 'zn_register_menu2' ) ) {
  7288.  
  7289. function zn_register_menu2() {
  7290.  
  7291. if ( function_exists('wp_nav_menu') ) {
  7292.  
  7293. add_theme_support( 'nav-menus' );
  7294.  
  7295. register_nav_menus( array(
  7296.  
  7297. 'header_navigation' => esc_html__( 'Header Navigation', THEMENAME ),
  7298.  
  7299. ) );
  7300.  
  7301. }
  7302.  
  7303. }
  7304.  
  7305. }
  7306.  
  7307.  
  7308.  
  7309. /*--------------------------------------------------------------------------------------------------
  7310.  
  7311. Check for boxed layout or full
  7312.  
  7313. --------------------------------------------------------------------------------------------------*/
  7314.  
  7315.  
  7316.  
  7317. // Add specific CSS class by filter
  7318.  
  7319. add_filter('body_class','zn_body_class_names');
  7320.  
  7321. if ( ! function_exists( 'zn_body_class_names' ) ) {
  7322.  
  7323. function zn_body_class_names($classes) {
  7324.  
  7325. global $data;
  7326.  
  7327. if ( (!empty ( $data['zn_boxed_layout'] ) && $data['zn_boxed_layout'] == 'yes' ) || ( is_front_page() && !empty( $data['zn_home_boxed_layout'] ) && $data['zn_home_boxed_layout'] =='yes' )) {
  7328.  
  7329.  
  7330.  
  7331. $classes[] = 'boxed';
  7332.  
  7333.  
  7334.  
  7335. }
  7336.  
  7337.  
  7338.  
  7339. if ( is_front_page() && !empty( $data['zn_home_boxed_layout'] ) && $data['zn_home_boxed_layout'] =='no' ){
  7340.  
  7341. $classes = array_diff($classes, array("boxed"));
  7342.  
  7343. }
  7344.  
  7345.  
  7346.  
  7347. if ($data['zn_width'] == '1170' && $data['zn_responsive'] == 'yes') {
  7348.  
  7349.  
  7350.  
  7351. $classes[] = 'res1170';
  7352.  
  7353.  
  7354.  
  7355. }
  7356.  
  7357. if ($data['zn_width'] == '960') {
  7358.  
  7359.  
  7360.  
  7361. $classes[] = 'res960';
  7362.  
  7363.  
  7364.  
  7365. }
  7366.  
  7367. return $classes;
  7368.  
  7369. }
  7370.  
  7371. }
  7372.  
  7373.  
  7374.  
  7375. /*--------------------------------------------------------------------------------------------------
  7376.  
  7377. Add AFTER BODY ACTIONS
  7378.  
  7379. --------------------------------------------------------------------------------------------------*/
  7380.  
  7381. add_action( 'zn_after_body', 'zn_add_page_loading',10 );
  7382.  
  7383. if ( !function_exists('zn_add_page_loading') ) {
  7384.  
  7385. function zn_add_page_loading(){
  7386.  
  7387. echo zn_page_loading();
  7388.  
  7389. }
  7390.  
  7391. }
  7392.  
  7393.  
  7394.  
  7395. /* SUPPORT PANEL */
  7396.  
  7397. add_action( 'zn_after_body', 'zn_add_hidden_panel',10 );
  7398.  
  7399. if ( !function_exists('zn_add_hidden_panel') ) {
  7400.  
  7401. function zn_add_hidden_panel(){
  7402.  
  7403. echo zn_hidden_pannel();
  7404.  
  7405. }
  7406.  
  7407. }
  7408.  
  7409.  
  7410.  
  7411. /* LOGIN FORM */
  7412.  
  7413. add_action( 'zn_after_body', 'zn_add_login_form',10 );
  7414.  
  7415. if ( !function_exists('zn_add_login_form') ) {
  7416.  
  7417. function zn_add_login_form(){
  7418.  
  7419. echo zn_login_form();
  7420.  
  7421. }
  7422.  
  7423. }
  7424.  
  7425.  
  7426.  
  7427. /* OPEN GRAPH */
  7428.  
  7429. add_action( 'zn_after_body', 'zn_add_open_graph',10 );
  7430.  
  7431. if ( !function_exists('zn_add_open_graph') ) {
  7432.  
  7433. function zn_add_open_graph(){
  7434.  
  7435. echo zn_f_o_g();
  7436.  
  7437. }
  7438.  
  7439. }
  7440.  
  7441.  
  7442.  
  7443. /*--------------------------------------------------------------------------------------------------
  7444.  
  7445. Add MENU to top area
  7446.  
  7447. --------------------------------------------------------------------------------------------------*/
  7448.  
  7449. add_action( 'zn_head_right_area', 'zn_add_navigation',40 );
  7450.  
  7451. if ( !function_exists('zn_add_navigation') ) {
  7452.  
  7453. function zn_add_navigation(){
  7454.  
  7455. echo zn_show_nav('header_navigation');
  7456.  
  7457. }
  7458.  
  7459. }
  7460.  
  7461.  
  7462.  
  7463. /*--------------------------------------------------------------------------------------------------
  7464.  
  7465. Add Right content to action
  7466.  
  7467. --------------------------------------------------------------------------------------------------*/
  7468.  
  7469. add_action( 'zn_head_right_area', 'zn_hidden_pannel_link',30 );
  7470.  
  7471. if ( !function_exists('zn_hidden_pannel_link') ) {
  7472.  
  7473. function zn_hidden_pannel_link(){
  7474.  
  7475.  
  7476.  
  7477. if ( is_active_sidebar( 'hiddenpannelsidebar' ) ) {
  7478.  
  7479.  
  7480.  
  7481. /*?>
  7482.  
  7483. <ul class="topnav navRight">
  7484.  
  7485. <li><a href="#" id="open_sliding_panel">
  7486.  
  7487. <span class="icon-remove-circle icon-white"></span> <?php _e('OFFICE HOURS: 8:00 AM to 5:00 PM',THEMENAME);?>
  7488.  
  7489. </a>
  7490.  
  7491. </li>
  7492.  
  7493. </ul>
  7494.  
  7495. <?php
  7496. */
  7497. }
  7498.  
  7499. }
  7500.  
  7501. }
  7502.  
  7503.  
  7504.  
  7505. /*--------------------------------------------------------------------------------------------------
  7506.  
  7507. Login Form - Login/logout text
  7508.  
  7509. --------------------------------------------------------------------------------------------------*/
  7510.  
  7511. add_action( 'zn_head_right_area', 'zn_login_text',20 );
  7512.  
  7513.  
  7514.  
  7515. if ( ! function_exists( 'zn_login_text' ) ) {
  7516.  
  7517. function zn_login_text() {
  7518.  
  7519. global $data;
  7520.  
  7521. // CHECK IF OPTION IS ENABLED
  7522.  
  7523. if ( !$data['head_show_login'] ) {
  7524.  
  7525. return '';
  7526.  
  7527. }
  7528.  
  7529. if ( is_user_logged_in() ) {
  7530.  
  7531. echo '<ul class="topnav navRight"><li><a href="'.wp_logout_url( get_home_url() ).'">'.__("LOGOUT",THEMENAME).'</a></li></ul>';
  7532.  
  7533. }
  7534.  
  7535. else {
  7536.  
  7537. echo '<ul class="topnav navRight"><li><a href="#login_panel" data-rel="prettyPhoto[login_panel]">'.__("LOGIN",THEMENAME).'</a></li></ul>';
  7538.  
  7539. }
  7540.  
  7541. }
  7542.  
  7543. }
  7544.  
  7545.  
  7546.  
  7547. /*--------------------------------------------------------------------------------------------------
  7548.  
  7549. SHOW HEADER SOCIAL ICONS
  7550.  
  7551. --------------------------------------------------------------------------------------------------*/
  7552.  
  7553. add_action( 'zn_head_right_area', 'zn_header_social_icons',10 );
  7554.  
  7555.  
  7556.  
  7557. if ( ! function_exists( 'zn_header_social_icons' ) ) {
  7558.  
  7559. function zn_header_social_icons() {
  7560.  
  7561. global $data;
  7562.  
  7563. if ( isset( $data['header_social_icons'] ) && is_array( $data['header_social_icons'] ) && !empty ( $data['header_social_icons'][0]['header_social_icon'] ) ) {
  7564.  
  7565.  
  7566.  
  7567. $icon_class = '';
  7568.  
  7569.  
  7570.  
  7571.  
  7572.  
  7573. if( $data['header_which_icons_set'] == 'colored' ) {
  7574.  
  7575. $icon_class = 'colored';
  7576.  
  7577. }
  7578.  
  7579.  
  7580.  
  7581. echo '<ul class="social-icons '.$icon_class.' topnav navRight">';
  7582.  
  7583.  
  7584.  
  7585. foreach ( $data['header_social_icons'] as $key=>$icon ){
  7586.  
  7587.  
  7588.  
  7589. $link = '';
  7590.  
  7591. $target = '';
  7592.  
  7593.  
  7594.  
  7595. if ( isset ( $icon['header_social_link'] ) && is_array ( $icon['header_social_link'] )) {
  7596.  
  7597. $link = $icon['header_social_link']['url'];
  7598.  
  7599. $target = 'target="'.$icon['header_social_link']['target'].'"';
  7600.  
  7601. }
  7602.  
  7603.  
  7604.  
  7605.  
  7606.  
  7607. echo '<li class="'.$icon['header_social_icon'].'"><a href="'.$link.'" '.$target.'>'.$icon['header_social_title'].'</a></li>';
  7608.  
  7609. }
  7610.  
  7611.  
  7612.  
  7613. echo '</ul>';
  7614.  
  7615.  
  7616.  
  7617. }
  7618.  
  7619. }
  7620.  
  7621. }
  7622.  
  7623.  
  7624.  
  7625. /*--------------------------------------------------------------------------------------------------
  7626.  
  7627. Add WOOCOMMERCE CART LINK
  7628.  
  7629. --------------------------------------------------------------------------------------------------*/
  7630.  
  7631. add_action( 'zn_head_right_area', 'zn_woocomerce_cart',2 );
  7632.  
  7633.  
  7634.  
  7635. if ( ! function_exists( 'zn_woocomerce_cart' ) ) {
  7636.  
  7637. function zn_woocomerce_cart () {
  7638.  
  7639. include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
  7640.  
  7641. if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
  7642.  
  7643.  
  7644.  
  7645. global $data;
  7646.  
  7647.  
  7648.  
  7649. if ( $data['woo_show_cart'] ) {
  7650.  
  7651. global $woocommerce;
  7652.  
  7653. ?>
  7654.  
  7655. <ul class="topnav navLeft">
  7656.  
  7657. <li class="drop">
  7658.  
  7659. <a id="mycartbtn" href="<?php echo $woocommerce->cart->get_cart_url(); ?>" title="<?php _e('View your shopping cart', 'woothemes'); ?>">
  7660.  
  7661. <?php _e( "MY CART",THEMENAME);?>
  7662.  
  7663. </a>
  7664.  
  7665. <div class="pPanel">
  7666.  
  7667. <div class="inner"> <span class="cart_details"><?php echo sprintf(_n('%d item', '%d items', $woocommerce->cart->cart_contents_count, 'woothemes'), $woocommerce->cart->cart_contents_count);?>, <?php _e("Total of",THEMENAME);?> <?php echo $woocommerce->cart->get_cart_total(); ?> <a href="<?php echo $woocommerce->cart->get_cart_url(); ?>" title="<?php _e('View your shopping cart', 'woothemes'); ?>" class="checkout"><?php _e("Checkout",THEMENAME);?> <span class="icon-chevron-right"></span>
  7668.  
  7669. </a>
  7670.  
  7671. </span>
  7672.  
  7673. </div>
  7674.  
  7675. </div>
  7676.  
  7677. </li>
  7678.  
  7679. </ul>
  7680.  
  7681. <?php
  7682.  
  7683. }
  7684.  
  7685. }
  7686.  
  7687. }
  7688.  
  7689. }
  7690.  
  7691.  
  7692.  
  7693. /*--------------------------------------------------------------------------------------------------
  7694.  
  7695. WPML language switcher
  7696.  
  7697. --------------------------------------------------------------------------------------------------*/
  7698.  
  7699. add_action( 'zn_head_right_area', 'zn_wpml_language_switcher',3 );
  7700.  
  7701.  
  7702.  
  7703. if ( ! function_exists( 'zn_wpml_language_switcher' ) ) {
  7704.  
  7705. function zn_wpml_language_switcher () {
  7706.  
  7707.  
  7708.  
  7709. if ( function_exists('icl_get_languages')) {
  7710.  
  7711. global $data;
  7712.  
  7713.  
  7714.  
  7715. if ( $data['head_show_flags'] ) {
  7716.  
  7717. echo '<ul class="topnav navLeft">';
  7718.  
  7719. echo '<li class="languages drop"><a href="#"><span class="icon-globe icon-white"></span> '.__("LANGUAGES",THEMENAME).'</a>';
  7720.  
  7721. echo '<div class="pPanel">';
  7722.  
  7723. echo '<ul class="inner">';
  7724.  
  7725.  
  7726.  
  7727. $languages = icl_get_languages('skip_missing=0');
  7728.  
  7729. if(1 < count($languages)){
  7730.  
  7731. foreach($languages as $l){
  7732.  
  7733. $active = '';
  7734.  
  7735. $icon = '';
  7736.  
  7737.  
  7738.  
  7739. if ( $l['active'] ){
  7740.  
  7741. $active = 'active';
  7742.  
  7743. $icon = '<span class="icon-ok"></span></a></li>';
  7744.  
  7745. }
  7746.  
  7747. echo '<li class="'.$active.'"><a href="'.$l['url'].'">'.$l['translated_name'].' '.$icon.'';
  7748.  
  7749.  
  7750.  
  7751. }
  7752.  
  7753.  
  7754.  
  7755. }
  7756.  
  7757. echo '</ul>';
  7758.  
  7759. echo '</div>';
  7760.  
  7761. echo '</li>';
  7762.  
  7763. echo '</ul>';
  7764.  
  7765. }
  7766.  
  7767. }
  7768.  
  7769.  
  7770.  
  7771.  
  7772.  
  7773. }
  7774.  
  7775. }
  7776.  
  7777.  
  7778.  
  7779. /*--------------------------------------------------------------------------------------------------
  7780.  
  7781. Select first image in post
  7782.  
  7783. --------------------------------------------------------------------------------------------------*/
  7784.  
  7785. if ( ! function_exists( 'echo_first_image' ) ) {
  7786.  
  7787. function echo_first_image( ) {
  7788.  
  7789. global $post;
  7790.  
  7791. $id = $post->ID;
  7792.  
  7793. $attachments = get_children( array( 'post_parent' => $id,
  7794.  
  7795. 'numberposts' => 1,
  7796.  
  7797. 'post_type' => 'attachment',
  7798.  
  7799. 'post_mime_type' => 'image',
  7800.  
  7801. 'order' => 'DESC',
  7802.  
  7803. 'orderby' => 'menu_order date')
  7804.  
  7805. );
  7806.  
  7807.  
  7808.  
  7809. // Search for and get the post attachment
  7810.  
  7811. if ( ! empty( $attachments ) ) {
  7812.  
  7813. $counter = -1;
  7814.  
  7815. foreach ( $attachments as $att_id => $attachment ) {
  7816.  
  7817. $counter++;
  7818.  
  7819.  
  7820.  
  7821. if ( $counter < 0 )
  7822.  
  7823. continue;
  7824.  
  7825.  
  7826.  
  7827. $src = wp_get_attachment_url( $att_id );
  7828.  
  7829. return $src;
  7830.  
  7831.  
  7832.  
  7833.  
  7834.  
  7835. }
  7836.  
  7837.  
  7838.  
  7839. // Get the first img tag from content
  7840.  
  7841. } else {
  7842.  
  7843. //print_r($post->post_content);
  7844.  
  7845. $first_img = '';
  7846.  
  7847. $post = get_post( $id );
  7848.  
  7849. ob_start();
  7850.  
  7851. ob_end_clean();
  7852.  
  7853. $output = preg_match_all( '/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches );
  7854.  
  7855. if ( !empty($matches[1][0]) && basename($matches[1][0]) != 'trans.gif') {
  7856.  
  7857.  
  7858.  
  7859. // Save Image URL
  7860.  
  7861. return esc_url( $matches[1][0] );
  7862.  
  7863.  
  7864.  
  7865. }
  7866.  
  7867. elseif (!empty($matches[1][1])) {
  7868.  
  7869. return esc_url( $matches[1][1] );
  7870.  
  7871. }
  7872.  
  7873.  
  7874.  
  7875. }
  7876.  
  7877. return;
  7878.  
  7879. }
  7880.  
  7881. }
  7882.  
  7883.  
  7884.  
  7885. /*--------------------------------------------------------------------------------------------------
  7886.  
  7887. Documentation Post Type
  7888.  
  7889. --------------------------------------------------------------------------------------------------*/
  7890.  
  7891.  
  7892.  
  7893. add_action('init','zn_documentation_post_type');
  7894.  
  7895. if ( ! function_exists( 'zn_documentation_post_type' ) ) {
  7896.  
  7897. function zn_documentation_post_type() {
  7898.  
  7899.  
  7900.  
  7901. $labels = array(
  7902.  
  7903. 'name' => 'Documentation',
  7904.  
  7905. 'singular_name' => 'Documentation Item',
  7906.  
  7907. 'add_new' => 'Add New Documentation Item',
  7908.  
  7909. 'all_items' => 'All Documentation Items',
  7910.  
  7911. 'add_new_item' => 'Add New Documentation',
  7912.  
  7913. 'edit_item' => 'Edit Documentation Item',
  7914.  
  7915. 'new_item' => 'New Documentation Item',
  7916.  
  7917. 'view_item' => 'View Documentation Item',
  7918.  
  7919. 'search_items' => 'Search Documentation Items',
  7920.  
  7921. 'not_found' => 'No Documentation Items found',
  7922.  
  7923. 'not_found_in_trash' => 'No Documentation Items found in trash',
  7924.  
  7925. 'parent_item_colon' => 'Parent Documentation:',
  7926.  
  7927. 'menu_name' => 'Documentation Items'
  7928.  
  7929. );
  7930.  
  7931.  
  7932.  
  7933. $args = array(
  7934.  
  7935. 'labels' => $labels,
  7936.  
  7937. 'description' => "",
  7938.  
  7939. 'public' => true,
  7940.  
  7941. 'exclude_from_search' => false,
  7942.  
  7943. 'publicly_queryable' => true,
  7944.  
  7945. 'show_ui' => true,
  7946.  
  7947. 'show_in_nav_menus' => true,
  7948.  
  7949. 'show_in_menu' => true,
  7950.  
  7951. 'show_in_admin_bar' => true,
  7952.  
  7953. 'menu_position' => 100,
  7954.  
  7955. 'menu_icon' => ADMIN_IMAGES_DIR.'/portfolio.png',
  7956.  
  7957. 'capability_type' => 'post',
  7958.  
  7959. 'hierarchical' => false,
  7960.  
  7961. 'supports' => array('title','editor'),
  7962.  
  7963. 'has_archive' => true,
  7964.  
  7965. 'rewrite' => true,
  7966.  
  7967. 'query_var' => true,
  7968.  
  7969. 'can_export' => true
  7970.  
  7971. );
  7972.  
  7973.  
  7974.  
  7975. register_post_type('documentation',$args);
  7976.  
  7977. }
  7978.  
  7979. }
  7980.  
  7981.  
  7982.  
  7983. /*--------------------------------------------------------------------------------------------------
  7984.  
  7985. Documentation Post Taxonomy
  7986.  
  7987. --------------------------------------------------------------------------------------------------*/
  7988.  
  7989.  
  7990.  
  7991. add_action( 'init', 'zn_documentation_category', 0 );
  7992.  
  7993. if ( ! function_exists( 'zn_documentation_category' ) ) {
  7994.  
  7995. function zn_documentation_category()
  7996.  
  7997. {
  7998.  
  7999. // Add new taxonomy, make it hierarchical (like categories)
  8000.  
  8001. $labels = array(
  8002.  
  8003. 'name' => __( 'Categories',THEMENAME),
  8004.  
  8005. 'singular_name' => __( 'Category',THEMENAME ),
  8006.  
  8007. 'search_items' => __( 'Search Categories',THEMENAME ),
  8008.  
  8009. 'all_items' => __( 'All Categories',THEMENAME ),
  8010.  
  8011. 'parent_item' => __( 'Parent Category',THEMENAME ),
  8012.  
  8013. 'parent_item_colon' => __( 'Parent Category:',THEMENAME ),
  8014.  
  8015. 'edit_item' => __( 'Edit Category',THEMENAME ),
  8016.  
  8017. 'update_item' => __( 'Update Category',THEMENAME ),
  8018.  
  8019. 'add_new_item' => __( 'Add New Category',THEMENAME ),
  8020.  
  8021. 'new_item_name' => __( 'New Category Name',THEMENAME ),
  8022.  
  8023. 'menu_name' => __( 'Documentation categories',THEMENAME ),
  8024.  
  8025. );
  8026.  
  8027.  
  8028.  
  8029. register_taxonomy('documentation_category','documentation', array(
  8030.  
  8031. 'hierarchical' => true,
  8032.  
  8033. 'labels' => $labels,
  8034.  
  8035. 'show_ui' => true,
  8036.  
  8037. 'query_var' => true,
  8038.  
  8039. 'rewrite' => true,
  8040.  
  8041. ));
  8042.  
  8043. }
  8044.  
  8045. }
  8046.  
  8047.  
  8048.  
  8049. /*--------------------------------------------------------------------------------------------------
  8050.  
  8051. LOGIN SYSTEM
  8052.  
  8053. --------------------------------------------------------------------------------------------------*/
  8054.  
  8055. if ( ! function_exists( 'zn_do_login' ) ) {
  8056.  
  8057. function zn_do_login()
  8058.  
  8059. {
  8060.  
  8061.  
  8062.  
  8063. if ( $_POST['zn_form_action'] == 'login' ) {
  8064.  
  8065. $user = wp_signon();
  8066.  
  8067. if ( is_wp_error($user) ) {
  8068.  
  8069. echo '<div id="login_error">'.$user->get_error_message().'</div>';
  8070.  
  8071. die();
  8072.  
  8073. }
  8074.  
  8075. else{
  8076.  
  8077. echo 'success';
  8078.  
  8079. die();
  8080.  
  8081. }
  8082.  
  8083. }
  8084.  
  8085. elseif( $_POST['zn_form_action'] == 'register' ){
  8086.  
  8087.  
  8088.  
  8089. $zn_error = false;
  8090.  
  8091. $zn_error_message = array();
  8092.  
  8093.  
  8094.  
  8095. if ( !empty( $_POST['user_login'] ) ) {
  8096.  
  8097. if ( username_exists( $_POST['user_login'] ) ){
  8098.  
  8099. $zn_error = true;
  8100.  
  8101. $zn_error_message[] = __('The username already exists',THEMENAME);
  8102.  
  8103. }
  8104.  
  8105. else {
  8106.  
  8107. $username = $_POST['user_login'];
  8108.  
  8109. }
  8110.  
  8111.  
  8112.  
  8113. }
  8114.  
  8115. else {
  8116.  
  8117. $zn_error = true;
  8118.  
  8119. $zn_error_message[] = __('Please enter an username',THEMENAME);
  8120.  
  8121. }
  8122.  
  8123.  
  8124.  
  8125. if ( !empty( $_POST['user_password'] ) ) {
  8126.  
  8127. $password = $_POST['user_password'];
  8128.  
  8129. }
  8130.  
  8131. else {
  8132.  
  8133. $zn_error = true;
  8134.  
  8135. $zn_error_message[] = __('Please enter a password',THEMENAME);
  8136.  
  8137. }
  8138.  
  8139.  
  8140.  
  8141. if ( ( empty( $_POST['user_password'] ) && empty( $_POST['user_password2'] ) ) || $_POST['user_password'] != $_POST['user_password2'] ) {
  8142.  
  8143. $zn_error = true;
  8144.  
  8145. $zn_error_message[] = __('Passwords do not match',THEMENAME);
  8146.  
  8147. }
  8148.  
  8149.  
  8150.  
  8151.  
  8152.  
  8153. if ( !empty( $_POST['user_email'] ) ) {
  8154.  
  8155.  
  8156.  
  8157. if( !email_exists( $_POST['user_email'] )) {
  8158.  
  8159. if (!filter_var($_POST['user_email'], FILTER_VALIDATE_EMAIL)) {
  8160.  
  8161. $zn_error = true;
  8162.  
  8163. $zn_error_message[] = __('Please enter a valid EMAIL address',THEMENAME);
  8164.  
  8165. }
  8166.  
  8167. else{
  8168.  
  8169. $email = $_POST['user_email'];
  8170.  
  8171. }
  8172.  
  8173.  
  8174.  
  8175. }
  8176.  
  8177. else {
  8178.  
  8179. $zn_error = true;
  8180.  
  8181. $zn_error_message[] = __('This email address has already been used',THEMENAME);
  8182.  
  8183. }
  8184.  
  8185.  
  8186.  
  8187. }
  8188.  
  8189. else {
  8190.  
  8191. $zn_error = true;
  8192.  
  8193. $zn_error_message[] = __('Please enter an email address',THEMENAME);
  8194.  
  8195. }
  8196.  
  8197.  
  8198.  
  8199.  
  8200.  
  8201.  
  8202.  
  8203.  
  8204.  
  8205. if ( $zn_error ){
  8206.  
  8207. echo '<div id="login_error">';
  8208.  
  8209. foreach ( $zn_error_message as $error) {
  8210.  
  8211. echo $error.'<br />';
  8212.  
  8213. }
  8214.  
  8215. echo '</div>';
  8216.  
  8217.  
  8218.  
  8219. die();
  8220.  
  8221. }
  8222.  
  8223. else {
  8224.  
  8225. $user_data = array(
  8226.  
  8227. 'ID' => '',
  8228.  
  8229. 'user_pass' => $password,
  8230.  
  8231. 'user_login' => $username,
  8232.  
  8233. 'display_name' => $username,
  8234.  
  8235. 'user_email' => $email,
  8236.  
  8237. 'role' => get_option('default_role') // Use default role or another role, e.g. 'editor'
  8238.  
  8239. );
  8240.  
  8241. $user_id = wp_insert_user( $user_data );
  8242.  
  8243. wp_new_user_notification( $user_id, $password );
  8244.  
  8245.  
  8246.  
  8247. echo '<div id="login_error">'.__('Your account has been created.',THEMENAME).'</div>';
  8248.  
  8249. die();
  8250.  
  8251.  
  8252.  
  8253. }
  8254.  
  8255.  
  8256.  
  8257.  
  8258.  
  8259. }
  8260.  
  8261. elseif( $_POST['zn_form_action'] == 'reset_pass' ){
  8262.  
  8263. echo do_action('login_form', 'resetpass');
  8264.  
  8265. }
  8266.  
  8267.  
  8268.  
  8269. }
  8270.  
  8271. }
  8272.  
  8273.  
  8274.  
  8275. add_action("wp_ajax_nopriv_zn_do_login", "zn_do_login");
  8276.  
  8277. add_action("wp_ajax_zn_do_login", "zn_do_login");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement