PageRenderTime 45ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/themes/gentle/functions.php

https://github.com/kikaendeavor/wordpress
PHP | 802 lines | 526 code | 162 blank | 114 comment | 67 complexity | 308ed4f956d48b8109543675f699a1f7 MD5 | raw file
Possible License(s): GPL-2.0, GPL-3.0, AGPL-1.0, LGPL-2.1
  1. <?php
  2. define('MPC_THEME_ROOT', get_template_directory_uri());
  3. global $shortname;
  4. global $mp_option;
  5. $shortname = "gentle";
  6. /* Enable the shortcodes to work in sidebar */
  7. add_filter('widget_text', 'do_shortcode');
  8. /*-----------------------------------------------------------------------------------*/
  9. /* Setup Theme
  10. /*-----------------------------------------------------------------------------------*/
  11. function gentle_setup(){
  12. //flush_rewrite_rules();
  13. if ( ! isset( $content_width ) ) $content_width = 960;
  14. /*-----------------------------------------------------------------------------------*/
  15. /* Hook MPC Shortcode button & Shortcodes Source
  16. /*-----------------------------------------------------------------------------------*/
  17. require_once (TEMPLATEPATH . '/tinymce/tinymce-settings.php');
  18. require_once (TEMPLATEPATH . '/functions/theme-shortcodes.php');
  19. /*--------------------------- END Shortcodes Hook -------------------------------- */
  20. /*-----------------------------------------------------------------------------------*/
  21. /* Setup image sizes
  22. /*-----------------------------------------------------------------------------------*/
  23. if (function_exists('add_theme_support')) {
  24. add_theme_support( 'automatic-feed-links');
  25. add_theme_support('post-thumbnails');
  26. add_image_size('recent_portfolio', 215, 215, true);
  27. add_image_size('recent_post', 100, 100, true);
  28. add_image_size('blog_classic_small', 649, 200, true);
  29. add_image_size('blog_classic', 960, 400, true);
  30. add_image_size('blog_classic_square', 350, 350, true);
  31. add_image_size('blog_classic_square_small', 200, 200, true);
  32. }
  33. require_once (TEMPLATEPATH . "/functions/theme-widgets.php");
  34. }
  35. add_action( 'after_setup_theme', 'gentle_setup' );
  36. /*--------------------------- END Setup Theme -------------------------------- */
  37. /*-----------------------------------------------------------------------------------*/
  38. /* Location Files / Language Files
  39. /*-----------------------------------------------------------------------------------*/
  40. load_theme_textdomain( 'gentle', TEMPLATEPATH.'/languages' );
  41. $locale = get_locale();
  42. $locale_file = MPC_THEME_ROOT."/languages/$locale.php";
  43. if ( is_readable($locale_file) )
  44. require_once($locale_file);
  45. /*-----------------------------------------------------------------------------------*/
  46. /* Register Menu
  47. /*-----------------------------------------------------------------------------------*/
  48. if ( function_exists( 'register_nav_menus' ) ) {
  49. register_nav_menus(
  50. array(
  51. 'main' => 'Main Navigation Menu',
  52. )
  53. );
  54. }
  55. /*-----------------------------------------------------------------------------------*/
  56. /* Add CSS & JS
  57. /*-----------------------------------------------------------------------------------*/
  58. function agera_enqueue_scripts() {
  59. wp_enqueue_style('mpc-reset-styles', MPC_THEME_ROOT.'/style.css');
  60. wp_enqueue_style('mpc-reset-styles', MPC_THEME_ROOT.'/css/reset.css');
  61. wp_enqueue_style('mpc-shortcodes-styles', MPC_THEME_ROOT.'/css/shortcodes-styles.css');
  62. wp_enqueue_style('mpc-widgets-styles', MPC_THEME_ROOT.'/css/widgets-styles.css');
  63. wp_enqueue_style('jquery-jcarousel-styles', MPC_THEME_ROOT.'/css/tango/skin.css');
  64. wp_enqueue_style('flex-slider', MPC_THEME_ROOT.'/css/flexslider.css');
  65. wp_enqueue_style('jquery-layerSlider', MPC_THEME_ROOT.'/css/jquery.layerSlider.css');
  66. wp_enqueue_style('nivo-slider', MPC_THEME_ROOT.'/css/nivo-slider.css');
  67. wp_enqueue_style('isotope-style', MPC_THEME_ROOT.'/css/isotope/style.css');
  68. wp_enqueue_style('fancybox-style', MPC_THEME_ROOT.'/css/fancybox.css');
  69. wp_enqueue_style('iconic-font', MPC_THEME_ROOT.'/css/font_icons.css');
  70. wp_enqueue_style('font-custom', 'http://fonts.googleapis.com/css?family=Open+Sans:400,300');
  71. wp_enqueue_script('custom-shortcodes', MPC_THEME_ROOT.'/js/shortcodes.js', array('jquery'));
  72. wp_enqueue_script('js-functions', MPC_THEME_ROOT.'/js/functions.js', array('jquery'));
  73. wp_enqueue_script('jquer-layerSlider', MPC_THEME_ROOT.'/js/jQuery.layerSlider.js', array('jquery'));
  74. wp_enqueue_script('nivo-slider', MPC_THEME_ROOT.'/js/jquery.nivo.slider.js', array('jquery'));
  75. wp_enqueue_script('jquery-ui', 'http://code.jquery.com/ui/1.9.0/jquery-ui.js', array('jquery'));
  76. wp_enqueue_script('jquery-colors', MPC_THEME_ROOT.'/js/jquery.color.js', array('jquery'));
  77. wp_enqueue_script('jquery-quicksand', MPC_THEME_ROOT.'/js/jquery.quicksand.js', array('jquery'));
  78. wp_enqueue_script('jquery-validate', MPC_THEME_ROOT.'/js/jquery.validate.min.js', array('jquery'));
  79. wp_enqueue_script('jquery-shadow', MPC_THEME_ROOT.'/js/jquery.shadow-animate.js', array('jquery'));
  80. wp_enqueue_script('jquery-carousel', MPC_THEME_ROOT.'/js/jquery.jcarousel.min.js', array('jquery'));
  81. wp_enqueue_script('isotope-js', MPC_THEME_ROOT.'/js/jquery.isotope.min.js', array('jquery'));
  82. wp_enqueue_script('jquery-flexslider', MPC_THEME_ROOT.'/js/jquery.flexslider.js');
  83. wp_enqueue_script('easing-jquery', MPC_THEME_ROOT.'/js/easing-jquery.js', array('jquery'));
  84. wp_enqueue_script('api-twitter', 'http://widgets.twimg.com/j/2/widget.js');
  85. wp_enqueue_script('fancybox-js', MPC_THEME_ROOT.'/js/jquery.fancybox.js', array('jquery'));
  86. wp_enqueue_script('detect-mobile', MPC_THEME_ROOT.'/js/modernizr.custom.js', array('jquery'));
  87. }
  88. add_action('wp_enqueue_scripts', 'agera_enqueue_scripts');
  89. remove_action( 'wp_head', 'rsd_link' );
  90. function gentle_add_my_head() {
  91. global $mp_option;
  92. global $shortname;
  93. ?>
  94. <meta http-equiv="Content-Type" charset="<?php bloginfo('charset'); ?>" content="<?php bloginfo('html_type'); ?>"/>
  95. <meta name="generator" content="WordPress <?php bloginfo('version'); ?>" />
  96. <title>
  97. <?php bloginfo('name'); ?>
  98. <?php wp_title(); ?>
  99. </title>
  100. <link rel="shortcut icon" href="<?php echo MPC_THEME_ROOT ?>/images/favicon.ico" />
  101. <link href='http://fonts.googleapis.com/css?family=Quicksand:300' rel='stylesheet' type='text/css'>
  102. <!--[if lte IE 8 ]>
  103. <link rel="stylesheet" href="<?php echo MPC_THEME_ROOT ?>/css/ie8.css"/>
  104. <![endif]-->
  105. <!--[if lte IE 7 ]>
  106. <script src"http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE8.js" type="text/javascript"></script>
  107. <link rel="stylesheet" href="<?php echo MPC_THEME_ROOT ?>/css/ie7.css"/>
  108. <![endif]-->
  109. <!--[if lt IE 9]>
  110. <script src="<?php echo MPC_THEME_ROOT ?>/js/html5.js" type="text/javascript"></script>
  111. <![endif]-->
  112. <!--[if IE]>
  113. <link rel="stylesheet" href="<?php echo MPC_THEME_ROOT ?>/css/ie.css"/>
  114. <![endif]-->
  115. <script>
  116. /*-----------------------------------------------------------------------------------*/
  117. /* Validate Comment Form
  118. /*-----------------------------------------------------------------------------------*/
  119. jQuery(document).ready(function($) {
  120. $.validator.addMethod("notEqual", function(value, element, param) {
  121. if(element.value == param)
  122. return false;
  123. else if(element.text == param)
  124. return false;
  125. else
  126. return true;
  127. }, "Please input value!");
  128. $.validator.addMethod("notEqual", function(value, element, param) {
  129. return value !== param;
  130. }, "Please input value!");
  131. /* Validation for comment form */
  132. $('#commentform').validate({
  133. rules: {
  134. author: {
  135. required: true,
  136. minlength: 2,
  137. notEqual: 'Name *'
  138. },
  139. email: {
  140. required: true,
  141. email: true,
  142. notEqual: 'Email *'
  143. },
  144. comment: {
  145. required: true,
  146. minlength: 5,
  147. notEqual: 'Message *'
  148. }
  149. },
  150. messages: {
  151. author: "<?php echo $mp_option[$shortname.'_comment_name_error']; ?>",
  152. email: "<?php echo $mp_option[$shortname.'_comment_email_error']; ?>",
  153. comment: "<?php echo $mp_option[$shortname.'_comment_comment_error']; ?>"
  154. }
  155. });
  156. });
  157. </script>
  158. <style>
  159. <?php
  160. global $mp_option;
  161. global $shortname; ?>
  162. /* background color */
  163. body { background-color: <?php echo $mp_option[$shortname.'_bg_color']?>; }
  164. div.post,
  165. #gentle-aside,
  166. #mpc-header .sub-menu,
  167. .gentle-recent-post,
  168. .jcarousel-item,
  169. .gentle-recent-portflio,
  170. .mpc-icon-column { background-color: <?php echo $mp_option[$shortname.'_bg_color']?>!important; }
  171. #mpc-header { background-color: <?php echo $mp_option[$shortname.'_bg_header_color']?>; }
  172. #gentle_footer { background-color: <?php echo $mp_option[$shortname.'_bg_footer_color']?>; }
  173. #gentle_footer .bottom-footer { background-color: <?php echo $mp_option[$shortname.'_bg_bottom_footer_color']?>; }
  174. .gentle-recent-post:hover,
  175. .gentle-recent-portflio:hover,
  176. .mpc-icon-column:hover,
  177. #mpc-page-wrap.full div.post:hover {
  178. transition: background 0.5s;
  179. -ms-transition: background 0.5s;
  180. -moz-transition: background 0.5s;
  181. -webkit-transition: background 0.5s;
  182. -o-transition: background 0.5;
  183. background-color: <?php echo $mp_option[$shortname.'_post_bg_hover']?>!important;
  184. }
  185. /* Text Color */
  186. /*#gentle-lm-info,
  187. h3.gentle-home-heading,
  188. h4.gentle-home-heading,
  189. .gentle-recent-post a h5,
  190. body a,
  191. body { color : <?php echo $mp_option[$shortname.'_body_color']?>!important; background: transparent; }*/
  192. #mpc-nav,
  193. #mpc-nav li a { color : <?php echo $mp_option[$shortname.'_menu_color']?>!important; }
  194. /* Active */
  195. body a:hover { color: <?php echo $mp_option[$shortname.'_active_color']?>!important; }
  196. #mpc-nav li a:hover { color : <?php echo $mp_option[$shortname.'_menu_selected_color']?>!important; }
  197. #mpc-nav li.current-menu-item > a { color : <?php echo $mp_option[$shortname.'_menu_selected_color']?>!important; }
  198. #mpc-nav li.current-menu-ancestor > a,
  199. #mpc-nav li.current-menu-parent > a { color : <?php echo $mp_option[$shortname.'_menu_selected_color']?>!important; }
  200. /* Lines */
  201. .bottom-footer,
  202. .mpc-icon-column,
  203. .mpc-icon-columns,
  204. div.post,
  205. pre,
  206. #mpc-nav .sub-menu,
  207. #mpc-nav .sub-menu li a,
  208. #gentle_latest_portfolio,
  209. #gentle_footer,
  210. #gentle_latest_posts_jcarousel,
  211. #mpc-page-content,
  212. #gentle-aside,
  213. #mpc-header-container,
  214. #mpc-slider-shortcode { border-color: <?php echo $mp_option[$shortname.'_hr_color']?>!important; }
  215. #mpc-nav > li span.nav-slash { color: <?php echo $mp_option[$shortname.'_hr_color']?>!important; }
  216. hr { background-color: <?php echo $mp_option[$shortname.'_hr_color']?>; }
  217. .mpc-gentle-deco,
  218. .gentle-deco-line,
  219. .nav-bar { background-color: <?php echo $mp_option[$shortname.'_active_hr_color']?>!important; }
  220. .mpc-gentle-deco,
  221. .widget_title { border-color: <?php echo $mp_option[$shortname.'_active_hr_color']?>!important; }
  222. .jcarousel-prev,
  223. .jcarousel-next { background-color: <?php echo $mp_option[$shortname.'_hr_color']?>!important; }
  224. .jcarousel-prev:hover,
  225. .jcarousel-next:hover { background-color: <?php echo $mp_option[$shortname.'_active_hr_color']?>!important; }
  226. .quick-flickr-item::after { background-color: <?php echo $mp_option[$shortname.'_active_hr_color']?>!important;}
  227. /* Forms */
  228. .post-comments input,
  229. .post-comments textarea,
  230. #contact_form input,
  231. #contact_form textarea { background-color : <?php echo $mp_option[$shortname.'_bg_contact_color']?>!important; color : <?php echo $mp_option[$shortname.'_text_contact_color']?>!important; }
  232. .post-comments input:hover,
  233. .post-comments textarea:hover,
  234. #contact_form input:hover,
  235. #contact_form textarea:hover { background-color: <?php echo $mp_option[$shortname.'_bg_contact_focus_color']?>!important; }
  236. /* Form Error */
  237. .post-comments input.error,
  238. .post-comments textarea.error,
  239. #contact_form input.error,
  240. #contact_form textarea.error { background-color: <?php echo $mp_option[$shortname.'_bg_contact_error_color']?>!important; color : <?php echo $mp_option[$shortname.'_contact_error_color']?>!important; border-color: <?php echo $mp_option[$shortname.'_bg_contact_labels_error_color']?>!important; }
  241. .post-comments label.error,
  242. #contact_form label.error { color : <?php echo $mp_option[$shortname.'_bg_contact_labels_error_color']?>!important; }
  243. .post-comments input#submit,
  244. #contact_form input#submit {
  245. background-color: <?php echo $mp_option[$shortname.'_bg_contact_submit']?>!important;
  246. color : <?php echo $mp_option[$shortname.'_color_contact_submit']?>!important;
  247. border-color : <?php echo $mp_option[$shortname.'_bg_button_border']?>!important;
  248. }
  249. .post-comments input#submit:hover,
  250. #contact_form input#submit:hover {
  251. background-color: <?php echo $mp_option[$shortname.'_bg_contact_submit_hover']?>!important;
  252. color : <?php echo $mp_option[$shortname.'_color_contact_submit_hover']?>!important;
  253. border-color : <?php echo $mp_option[$shortname.'_bg_button_border_hover']?>!important;
  254. }
  255. /* Search Form */
  256. input.gentle-search {
  257. background-color: <?php echo $mp_option[$shortname.'_bg_search']?>!important;
  258. color : <?php echo $mp_option[$shortname.'_search_text']?>!important;
  259. border-color : <?php echo $mp_option[$shortname.'_search_border']?>!important;
  260. }
  261. /* Shortcodes */
  262. .toggle-header,
  263. .toggle-content,
  264. .tabs ul li.tabs_title,
  265. .tabs .tab_content { background-color : <?php echo $mp_option[$shortname.'_sc_bg']?>!important;}
  266. #mpc-page-content.blog div.post .mpc-post-thumbnail blockquote {
  267. background-color : <?php echo $mp_option[$shortname.'_sc_bg_bq']?>!important;
  268. }
  269. /* Categories filter */
  270. .mpc-portfolio-categories li {
  271. background-color: <?php echo $mp_option[$shortname.'_bg_contact_color']?>!important;
  272. border-color: <?php echo $mp_option[$shortname.'_bg_contact_focus_color']?>!important;
  273. }
  274. /* Post Hover */
  275. .post .mpc-gentle-post-hover { background-color: <?php echo $mp_option[$shortname.'_post_overlay_bg']?>!important; }
  276. /* Load More */
  277. #gentle-load-more #gentle-lm-button { background-color: <?php echo $mp_option[$shortname.'_lm_bg']?>!important; color: <?php echo $mp_option[$shortname.'_lm_text']?>!important; }
  278. #gentle-load-more #gentle-lm-button:hover { background-color: <?php echo $mp_option[$shortname.'_lm_bg_hover']?>!important; color: <?php echo $mp_option[$shortname.'_lm_text_hover']?>!important; }
  279. /* Read More */
  280. .mpc-read-more {
  281. background-color: <?php echo $mp_option[$shortname.'_rm_bg']?>!important;
  282. }
  283. .mpc-read-more .mpc-line-ver,
  284. .mpc-read-more .mpc-line-hor {
  285. background-color: <?php echo $mp_option[$shortname.'_rm_icon']?>!important;
  286. }
  287. .mpc-read-more:hover {
  288. background-color: <?php echo $mp_option[$shortname.'_rm_bg_hover']?>!important;
  289. }
  290. .mpc-read-more:hover .mpc-line-ver,
  291. .mpc-read-more:hover .mpc-line-hor {
  292. background-color: <?php echo $mp_option[$shortname.'_rm_icon_hover']?>!important;
  293. }
  294. /* Highlight Color Setting */
  295. ::-moz-selection {
  296. background: <?php echo $mp_option[$shortname.'_highlight_color']; ?>;
  297. color: <?php echo $mp_option[$shortname.'_highlight_text_color']; ?>;
  298. }
  299. ::selection {
  300. background: <?php echo $mp_option[$shortname.'_highlight_color']; ?>;
  301. color: <?php echo $mp_option[$shortname.'_highlight_text_color']; ?>;
  302. }
  303. .search::-moz-selection {
  304. background: <?php echo $mp_option[$shortname.'_highlight_color']; ?>;
  305. color: <?php echo $mp_option[$shortname.'_highlight_text_color']; ?>;
  306. }
  307. /* Fix */
  308. .mpc-post-thumbnail .gentle-icon-eye { color: <?php echo $mp_option[$shortname.'_bg_color']?>!important; }
  309. .mpc-post-thumbnail .gentle-icon-eye:hover { color: <?php echo $mp_option[$shortname.'_bg_color']?>!important; }
  310. /* Custom CSS */
  311. <?php echo $mp_option[$shortname.'_custom_css']?>
  312. </style>
  313. <?php
  314. }
  315. add_action('wp_head', 'gentle_add_my_head');
  316. /*-----------------------------------------------------------------------------------*/
  317. /* Register Portfolio Post Type
  318. /*-----------------------------------------------------------------------------------*/
  319. function gentle_create_portfolio() {
  320. register_taxonomy('portfolio_cat','portfolio', array(
  321. 'hierarchical' => true,
  322. 'show_ui' => true,
  323. 'query_var' => true,
  324. )); // add unique categories to portfolio section
  325. $portfolio_args = array(
  326. 'label' => __('Portfolio', 'agera'),
  327. 'singular_label' => __('Portfolio', 'agera'),
  328. 'public' => true,
  329. 'show_ui' => true,
  330. 'capability_type' => 'post',
  331. 'hierarchical' => false,
  332. 'rewrite' => true,
  333. 'supports' => array('title', 'editor', 'thumbnail'),
  334. 'taxonomies' => array('post_tag')
  335. );
  336. register_post_type('portfolio', $portfolio_args);
  337. }
  338. add_action('init', 'gentle_create_portfolio');
  339. /*-----------------------------------------------------------------------------------*/
  340. /* Hook Massive Panel & Get Options
  341. /*-----------------------------------------------------------------------------------*/
  342. if(is_admin()) {
  343. require_once('massive-panel/theme-settings.php');
  344. }
  345. function gentle_get_global_options() {
  346. global $shortname;
  347. $mp_option = array();
  348. $mp_option = get_option($shortname.'_options');
  349. return $mp_option;
  350. }
  351. $mp_option = gentle_get_global_options();
  352. /*-----------------------------------------------------------------------------------*/
  353. /* Load More Content Hook
  354. /*-----------------------------------------------------------------------------------*/
  355. function load_content_init($query) {
  356. $max_pages = $query->max_num_pages;
  357. $posts_count = $query->found_posts;
  358. $posts_per_page = $query->post_count;
  359. $page = ( get_query_var('paged') > 1 ) ? get_query_var('paged') : 1;
  360. ?>
  361. <script>
  362. jQuery(document).ready(function($) {
  363. var max_pages = parseInt('<?php echo $max_pages; ?>');
  364. var posts_count = parseInt('<?php echo $posts_count; ?>');
  365. var posts_per_page = parseInt('<?php echo $posts_per_page; ?>');
  366. var page = parseInt('<?php echo $page; ?>') + 1;
  367. var next_page_link = '<?php echo next_posts($max_pages, false)?>';
  368. var $button = $('#gentle-lm-button');
  369. var $container = $("#mpc-page-content");
  370. var $loaded = $('#gentle-lm-info');
  371. $loaded.text(posts_per_page + ' / ' + posts_count);
  372. if(posts_count <= posts_per_page)
  373. $button.hide();
  374. $button.click(function() {
  375. if (page <= max_pages) {
  376. $(this).text('Loading...');
  377. $('<div></div>').load(next_page_link + ' .post', function() {
  378. var $posts = $(this).children();
  379. page++;
  380. next_page_link = next_page_link.replace(/page\/[0-9]\//, 'page/' + page);
  381. if (page <= max_pages) {
  382. $button.text('Load More');
  383. $loaded.text((posts_per_page * (page - 1)) + ' / ' + posts_count);
  384. } else {
  385. $button.stop().animate({ 'top': '30px' }, 500, 'easeOutExpo', function() {
  386. $(this).hide();
  387. });
  388. $loaded.text(posts_count + ' / ' + posts_count);
  389. }
  390. $container.append($posts);
  391. $posts.addClass('no-transition');
  392. $posts.css( { 'opacity' : 0 });
  393. if ($.browser.msie && parseInt($.browser.version, 10) === 8) {
  394. $container.isotope('addItems', $posts, function() {
  395. $(window).trigger('resize');
  396. $posts.animate({ 'opacity' : 1}, 2000, 'easeOutExpo', function() {
  397. $posts.removeClass('no-transition');
  398. });
  399. });
  400. }
  401. else {
  402. $container.imagesLoaded(function() {
  403. $container.isotope('addItems', $posts, function() {
  404. $(window).trigger('resize');
  405. $posts.animate({ 'opacity' : 1}, 2000, 'easeOutExpo', function() {
  406. $posts.removeClass('no-transition');
  407. });
  408. });
  409. });
  410. }
  411. setTimeout(function(){
  412. $(window).trigger('resize');
  413. }, 200);
  414. $(window).trigger('resize');
  415. });
  416. }
  417. });
  418. });
  419. </script>
  420. <?php }
  421. add_action('mpc_post_loop', 'load_content_init');
  422. /*-----------------------------------------------------------------------------------*/
  423. /* Triming the excerpt
  424. /*-----------------------------------------------------------------------------------*/
  425. function gentle_my_excerpt($string, $word_limit) {
  426. $words = explode(' ', $string, ($word_limit + 1));
  427. if (count($words) > $word_limit)
  428. array_pop($words);
  429. //$content = preg_replace('/<img[^>]+./','', $words);
  430. return strip_tags(implode(' ', $words) . '...');
  431. }
  432. /*-----------------------------------------------------------------------------------*/
  433. /* Add lightbox
  434. /*-----------------------------------------------------------------------------------*/
  435. function mpc_gentle_add_lightbox($post_data) {
  436. $output = '';
  437. if(isset($post_data['lb']) && $post_data['lb']) {
  438. $type = '';
  439. $asset = $post_data['lb_src'];
  440. $search = preg_match('/.(jpg|JPG|jpeg|JPEG|gif|GIF|png)/', $asset);
  441. if($search == 1) {
  442. $type = 'mpc-image';
  443. $search = 0;
  444. }
  445. $search = preg_match('/.(vimeo)./', $asset);
  446. if($search == 1) {
  447. $type = 'mpc-vimeo-video';
  448. $search = 0;
  449. }
  450. $search = preg_match('/.(youtube)/', $asset);
  451. if($search == 1) {
  452. $type = 'mpc-youtube-video';
  453. $search = 0;
  454. }
  455. $search = preg_match('/.(swf|SWF)/', $asset);
  456. if($search == 1) {
  457. $type = 'mpc-swf';
  458. $search = 0;
  459. }
  460. if($type == '') {
  461. $type = 'mpc-iframe';
  462. }
  463. // rel="'.$post_data['lb_gallery']."
  464. $output .= '<a class="gentle-icon-eye mpc-fancybox '.$type.'" href="'.$post_data['lb_src'].'" title="'.$post_data['lb_caption'].'" ></a>';
  465. }
  466. echo $output;
  467. }
  468. /*-----------------------------------------------------------------------------------*/
  469. /* List Comments
  470. /*-----------------------------------------------------------------------------------*/
  471. function comments_all($comment, $args, $depth) {
  472. $GLOBALS['comment'] = $comment; ?>
  473. <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
  474. <span class="comment-line"></span>
  475. <?php if(get_comment_author_email() == get_the_author_meta('email')){
  476. $author = "comment_author";
  477. } else {
  478. $author ="";
  479. }?>
  480. <div id="comment-<?php comment_ID(); ?>" class="comments_holder comment_line <?php echo $author; ?>" >
  481. <div class="comment-author vcard">
  482. <div class="gentle_comment_gravatar">
  483. <?php echo get_avatar(get_comment_author_email(), $size ='80'); ?>
  484. </div>
  485. <div class="comment_meta">
  486. <?php if($author == "comment_author") { ?>
  487. <span class="comment_author">
  488. <?php printf(__('<h4 class="comments_author"> %s</h4>', 'gentle'), get_comment_author_link()) ?>
  489. </span>
  490. <p class="comment_date"><time><?php printf(__('%1$s ', 'gentle'), get_comment_time('H:i F jS, Y')) ?> &middot;</time>
  491. <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
  492. &middot; <span class="author">author</span>
  493. </p>
  494. <?php } else { ?>
  495. <?php printf(__('<h4 class="comments_author"> %s</h4>', 'gentle'), get_comment_author_link()) ?>
  496. <p class="comment_date">On: <time datetime="2011-04-26"><?php printf(__('%1$s ', 'gentle'), get_comment_time('H:i F jS, Y')) ?> &middot;</time>
  497. <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
  498. </p>
  499. <?php } ?>
  500. </div>
  501. <div class="gentle_message">
  502. <?php comment_text() ?>
  503. </div>
  504. <div class="clear"></div>
  505. </div>
  506. </div>
  507. <?php
  508. }
  509. /*-----------------------------------------------------------------------------------*/
  510. /* Register Standard Sidebar & Footer
  511. /*
  512. /* footer can display 1 - 5 columns (default 3)
  513. /*-----------------------------------------------------------------------------------*/
  514. if ( function_exists('register_sidebar') )
  515. {
  516. register_sidebar(array(
  517. 'before_widget' => '<li id="%1$s" class="widget %2$s">',
  518. 'after_widget' => '</li>',
  519. 'before_title' => '<h5 class="widget_title sidebar_widget_title">',
  520. 'after_title' => '</h5>',
  521. 'name'=>'Main Sidebar'
  522. ));
  523. /* Create different number of footer columns */
  524. if(isset($mp_option[$shortname.'_number_of_footer_columns']) && $mp_option[$shortname.'_number_of_footer_columns'] == '1'){
  525. register_sidebar(array(
  526. 'before_widget' => '<li id="%1$s" class="widget widget_1 %2$s">',
  527. 'after_widget' => '</li>',
  528. 'before_title' => '<h5 class="widget_title footer_title">',
  529. 'after_title' => '</h5>',
  530. 'name'=>'Main Footer'
  531. ));
  532. } elseif(isset($mp_option[$shortname.'_number_of_footer_columns']) && $mp_option[$shortname.'_number_of_footer_columns'] == '2') {
  533. register_sidebar(array(
  534. 'before_widget' => '<li id="%1$s" class="widget widget_2 %2$s">',
  535. 'after_widget' => '</li>',
  536. 'before_title' => '<h5 class="widget_title footer_title">',
  537. 'after_title' => '</h5>',
  538. 'name'=>'Main Footer'
  539. ));
  540. } elseif(isset($mp_option[$shortname.'_number_of_footer_columns']) && $mp_option[$shortname.'_number_of_footer_columns'] == '4') {
  541. register_sidebar(array(
  542. 'before_widget' => '<li id="%1$s" class="widget widget_4 %2$s">',
  543. 'after_widget' => '</li>',
  544. 'before_title' => '<h5 class="widget_title footer_title">',
  545. 'after_title' => '</h5>',
  546. 'name'=>'Main Footer'
  547. ));
  548. } elseif(isset($mp_option[$shortname.'_number_of_footer_columns']) && $mp_option[$shortname.'_number_of_footer_columns'] == '5') {
  549. register_sidebar(array(
  550. 'before_widget' => '<li id="%1$s" class="widget widget_5 %2$s">',
  551. 'after_widget' => '</li>',
  552. 'before_title' => '<h5 class="widget_title footer_title">',
  553. 'after_title' => '</h5>',
  554. 'name'=>'Main Footer'
  555. ));
  556. } else {
  557. register_sidebar(array(
  558. 'before_widget' => '<li id="%1$s" class=" widget widget_3 %2$s">',
  559. 'after_widget' => '</li>',
  560. 'before_title' => '<h5 class="widget_title footer_title">',
  561. 'after_title' => '</h5>',
  562. 'name'=>'Main Footer'
  563. ));
  564. }
  565. }
  566. /*--------------------------- END Registering Sidebars -------------------------------- */
  567. /*-----------------------------------------------------------------------------------*/
  568. /* Register Custom Sidebars and Footers
  569. /*-----------------------------------------------------------------------------------*/
  570. // Pull all the pages into an array
  571. $options_pages = array();
  572. $options_pages_obj = get_pages('sort_column=post_parent,menu_order');
  573. foreach ($options_pages_obj as $page) {
  574. if(isset($mp_option[$shortname.'_sidebar']) && isset($mp_option[$shortname.'_sidebar']['sidebar_'.$page->ID]) && $mp_option[$shortname.'_sidebar']['sidebar_'.$page->ID] == "on"){
  575. if(function_exists('register_sidebar')) {
  576. register_sidebar(array(
  577. 'name' => $page->post_title.' Sidebar',
  578. 'description' => 'This is a custom sidebar for '.$page->post_title.' page.',
  579. 'before_widget' => '<li id="%1$s" class="widget %2$s">',
  580. 'after_widget' => '</li>',
  581. 'before_title' => '<h5 class="widget_title sidebar_widget_title">',
  582. 'after_title' => '</h5>'
  583. ));
  584. }
  585. }
  586. if(isset($mp_option[$shortname.'_sidebar']) && isset($mp_option[$shortname.'_sidebar']['footer_'.$page->ID]) && $mp_option[$shortname.'_sidebar']['footer_'.$page->ID] == "on"){
  587. if(function_exists('register_sidebar')) {
  588. if(isset($mp_option[$shortname.'_sidebar']['footer_columns_'.$page->ID]) && $mp_option[$shortname.'_sidebar']['footer_columns_'.$page->ID] == '1'){
  589. register_sidebar(array(
  590. 'description' => 'This is a custom footer for '.$page->post_title.' page.',
  591. 'before_widget' => '<li id="%1$s" class="widget widget_1 %2$s">',
  592. 'after_widget' => '</li>',
  593. 'before_title' => '<h5 class="widget_title footer_title">',
  594. 'after_title' => '</h5>',
  595. 'name'=> $page->post_title.' Footer'
  596. ));
  597. } elseif (isset($mp_option[$shortname.'_sidebar']['footer_columns_'.$page->ID]) && $mp_option[$shortname.'_sidebar']['footer_columns_'.$page->ID] == '2') {
  598. register_sidebar(array(
  599. 'description' => 'This is a custom footer for '.$page->post_title.' page.',
  600. 'before_widget' => '<li id="%1$s" class="widget widget_2 %2$s">',
  601. 'after_widget' => '</li>',
  602. 'before_title' => '<h5 class="widget_title footer_title">',
  603. 'after_title' => '</h5>',
  604. 'name'=> $page->post_title.' Footer'
  605. ));
  606. } elseif (isset($mp_option[$shortname.'_sidebar']['footer_columns_'.$page->ID]) && $mp_option[$shortname.'_sidebar']['footer_columns_'.$page->ID] == '4') {
  607. register_sidebar(array(
  608. 'description' => 'This is a custom footer for '.$page->post_title.' page.',
  609. 'before_widget' => '<li id="%1$s" class="widget widget_4 %2$s">',
  610. 'after_widget' => '</li>',
  611. 'before_title' => '<h5 class="widget_title footer_title">',
  612. 'after_title' => '</h5>',
  613. 'name'=> $page->post_title.' Footer'
  614. ));
  615. } elseif (isset($mp_option[$shortname.'_sidebar']['footer_columns_'.$page->ID]) && $mp_option[$shortname.'_sidebar']['footer_columns_'.$page->ID] == '5') {
  616. register_sidebar(array(
  617. 'description' => 'This is a custom footer for '.$page->post_title.' page.',
  618. 'before_widget' => '<li id="%1$s" class="widget widget_5 %2$s">',
  619. 'after_widget' => '</li>',
  620. 'before_title' => '<h5 class="widget_title footer_title">',
  621. 'after_title' => '</h5>',
  622. 'name'=> $page->post_title.' Footer'
  623. ));
  624. } else {
  625. register_sidebar(array(
  626. 'description' => 'This is a custom footer for '.$page->post_title.' page.',
  627. 'before_widget' => '<li id="%1$s" class=" widget widget_3 %2$s">',
  628. 'after_widget' => '</li>',
  629. 'before_title' => '<h5 class="widget_title footer_title">',
  630. 'after_title' => '</h5>',
  631. 'name'=> $page->post_title.' Footer'
  632. ));
  633. }
  634. }
  635. }
  636. }
  637. /*------------------- END Register Custom Sidebars and Footers --------------------- */
  638. /* WP-Admin meta boxes */
  639. require_once (TEMPLATEPATH . "/functions/custom-meta-boxes.php");
  640. ?>