Advertisement
towfiqi

functions.php

Dec 19th, 2013
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.31 KB | None | 0 0
  1. <?php
  2. add_theme_support( 'custom-background', array(
  3. 'default-color' => '',
  4. 'default-image' => get_template_directory_uri() . '/images/theronbg.png'
  5. ) );
  6.  
  7. add_theme_support('automatic-feed-links');
  8. if ( ! isset( $content_width ) )
  9. $content_width = 630;
  10.  
  11. //Post Thumbnail
  12.  
  13. add_theme_support( 'post-thumbnails' );
  14.  
  15. //Register Menus
  16. register_nav_menus( array(
  17. 'primary' => __( 'Primary Navigation', 'theron' ),
  18. 'footer' => __( 'Footer Navigation', 'theron' )
  19. ) );
  20.  
  21.  
  22. // wpml shortcodes --------------------
  23.  
  24. add_shortcode( 'wpml_language', 'wpml_find_language');
  25.  
  26.  
  27. /* ---------------------------------------------------------------------------
  28.  
  29. * Shortcode [wpml_language language="en"] [/wpml_language]
  30.  
  31. * --------------------------------------------------------------------------- */
  32.  
  33. function wpml_find_language( $attr, $content = null ){
  34.  
  35. extract(shortcode_atts(array(
  36.  
  37. 'language' => '',
  38.  
  39. ), $attr));
  40.  
  41. $current_language = ICL_LANGUAGE_CODE;
  42.  
  43. if($current_language == $language){
  44. $output = do_shortcode($content);
  45. }else{
  46. $output = "";
  47. }
  48.  
  49. return $output;
  50. }
  51.  
  52.  
  53.  
  54. function thn_ie_css() {
  55. if ( !is_admin() ) {
  56. wp_register_style( 'thn_ie', get_template_directory_uri().'/css/ie.css', false, 1.5 );
  57. $GLOBALS['wp_styles']->add_data( 'thn_ie', 'conditional', 'IE 8' );
  58. wp_enqueue_style( 'thn_ie' );
  59. }
  60. }
  61. add_action('wp_enqueue_scripts', 'thn_ie_css');
  62. function thn_other_css() {
  63. if ( !is_admin() ) {
  64. if(of_get_option('disslight_checkbox') == "0"){ ?><?php wp_enqueue_style('fancybox',get_template_directory_uri().'/css/fancybox.css'); }
  65. if(of_get_option('gglfont_checkbox') == "0"){ ?><?php wp_enqueue_style('customfont',get_template_directory_uri().'/fonts/'.$zn_fonts = of_get_option('font_select', 'yanone_kaffeesatz' ).'.css'); }
  66. }
  67. }
  68. add_action('wp_enqueue_scripts', 'thn_other_css');
  69.  
  70. function thn_enqueue_google_font($font) {
  71.  
  72. $font = of_get_option('gglfont_text');
  73. $font = str_replace(" ", "+", $font);
  74. if(of_get_option('gglfont_checkbox') == "1"){ ?><?php wp_enqueue_style( "thn_google_$font", "http://fonts.googleapis.com/css?family=$font", false, null, 'all' );}
  75.  
  76. }
  77. add_action( 'wp_enqueue_scripts', 'thn_enqueue_google_font' );
  78.  
  79. //Include CSS
  80. function thn_customstyle() { ?>
  81.  
  82. <?php if(of_get_option('sldrtxt_checkbox') == "0"){ ?> <style type="text/css">body .nivo-caption{ display:none!important;}</style><?php } ?>
  83. <?php /*?>Custom GOOGLE FONT */?>
  84. <?php if(of_get_option('gglfont_checkbox') == "1"){ ?>
  85. <style type="text/css">
  86. .lay1 .block_comm a, .lay2 .block_comm a, .lay3 .block_comm a{ float: left;line-height: 9px;margin-left: -3px;padding-top: 9px;text-align: center; font-family: '<?php echo of_get_option('gglfont_text');?>'; letter-spacing: 0.05em; font-weight: normal!important;}
  87. .lay1 .block_comm span, .lay2 .block_comm span, .lay3 .block_comm span{ float: left;line-height: 9px;margin-left: 3px;padding-top: 14px;text-align: center; font-family: '<?php echo of_get_option('gglfont_text');?>'; letter-spacing: 0.05em; font-weight: normal!important;}
  88. h1, h2, h3, h4, h5, h6, .trt_button a, #submit_msg, #submit_msg, #submit, .fourofour a, .trt_wgt_tt, #related ul li a, .logo h1 a, #slider .slider-content h2 a, .lay1 .post .postitle a, .lay1 .page .postitle a, #topmenu ul li a{ font-family: '<?php echo of_get_option('gglfont_text');?>'; letter-spacing: 0.05em; font-weight: normal!important;}
  89.  
  90. .postitle a{font-size:20px;}
  91. .single_page_post .postitle a{ font-size:24px;}
  92. #related .post_title, #submit_msg, #submit{font-family: '<?php echo of_get_option('gglfont_text');?>'!important;font-size:16px!important;}
  93. #topmenu ul li a{font-size:18px!important;}
  94.  
  95. #sidebar .widgets .widget ul li .znn_wgt_tt, #midrow .widgets .widget ul li .znn_wgt_tt, #footer .widgets .widget ul li .znn_wgt_tt{ font-family: '<?php echo of_get_option('gglfont_text');?>'; letter-spacing: 0.05em; font-weight: normal!important; font-size:15px;}
  96.  
  97. .lay1 .post_content h2 a, .lay2 .post_content h2 a{ font-size:16px!important;}
  98. #topmenu ul li ul li a{ font-size:14px!important;}
  99. #thn_welcom{font-family: '<?php echo of_get_option('gglfont_text');?>'!important;}
  100. #footer .widgets .widget ul li .thn_wgt_tt, #sidebar .widgets .widget li a, .commentlist .commentmetadata, .commentlist .commentmetadata a, #newslider_home ul#tabs_home li a h4{font-family: '<?php echo of_get_option('gglfont_text');?>'!important; font-size:16px;}
  101. </style>
  102. <?php } ?>
  103.  
  104. <?php /*?>ROUNDED CORNER<?php */?>
  105. <?php if(of_get_option('rounded_checkbox') == "1"){ ?>
  106. <style type="text/css">
  107.  
  108. <?php if(of_get_option('slider_select') == "noslider"){ ?>
  109. body .header2 #menu_wrap{border-radius:8px; -moz-border-radius:8px; -webkit-border-radius:8px;behavior: url(<?php echo get_template_directory_uri(); ?>/images/PIE.htc);}
  110. body .header1 #menu_wrap, body .header1 #header{border-radius:8px; -moz-border-radius:8px; -webkit-border-radius:8px;behavior: url(<?php echo get_template_directory_uri(); ?>/images/PIE.htc);}
  111. .slide_shadow{ display:none;}
  112. <?php } ?>
  113.  
  114. .home #topmenu, #header, .lay1 .post .imgwrap, .header2 #menu_wrap, .logo{border-radius: 8px 8px 0 0; -moz-border-radius: 8px 8px 0 0; -webkit-border-radius: 8px 8px 0 0;behavior: url(<?php echo get_template_directory_uri(); ?>/images/PIE.htc);}
  115.  
  116. .single-post #menu_wrap, .page #menu_wrap{border-radius: 0 0 8px 8px; -moz-border-radius: 0 0 8px 8px; -webkit-border-radius: 0 0 8px 8px;behavior: url(<?php echo get_template_directory_uri(); ?>/images/PIE.htc);}
  117.  
  118. .single-post .header3 #menu_wrap, .page .header3 #menu_wrap{ border-radius: 0px; -moz-border-radius: 0px; -webkit-border-radius: 0px;behavior: url(<?php echo get_template_directory_uri(); ?>/images/PIE.htc);}
  119.  
  120. #zn_slider, #topmenu ul li ul{border-radius: 0 0 8px 8px; -moz-border-radius: 0 0 8px 8px; -webkit-border-radius: 0 0 8px 8px;behavior: url(<?php echo get_template_directory_uri(); ?>/images/PIE.htc);}
  121. #topmenu, .midrow_blocks, #footer, #copyright, .lay1 .hentry, .single_post, #sidebar .widgets .widget, #commentform, .comment-form-comment textarea, .form-submit input, #searchsubmit, #related_wrap ul, .znn_paginate span, .znn_paginate a, .navigation a, .navigation span, .lay2, .lay3 .post_image, .lay3 .post_content, .comment-form-author input, .comment-form-email input, .comment-form-url input, #thn_welcom, .thn_paginate span, .thn_paginate a, .navigation a, .navigation span, .single-post #header, .page #header, #newslider_home .news_buttn, .single-post .header2 #menu_wrap, .page .header2 #menu_wrap, .lay2 .hentry, .lay4 .hentry, .lay3 .hentry, #newslider, .comments_template{border-radius:8px; -moz-border-radius:8px; -webkit-border-radius:8px;behavior: url(<?php echo get_template_directory_uri(); ?>/images/PIE.htc);}
  122. #commentform label{border-radius: 8px 0 0 8px; -moz-border-radius: 8px 0 0 8px; -webkit-border-radius: 8px 0 0 8px;behavior: url(<?php echo get_template_directory_uri(); ?>/images/PIE.htc);}
  123. #copyright{ margin-top:20px;}
  124. </style>
  125. <?php } ?>
  126.  
  127.  
  128. <?php /*?>ICON TPPE 1<?php */?>
  129. <?php if(of_get_option('icons_images') == "icons1"){ ?>
  130. <style type="text/css">
  131. .comm_date{ background:url(<?php echo get_template_directory_uri(); ?>/images/icons.png) no-repeat;background-position: 0px 3px;}
  132. .meta_auth{ background:url(<?php echo get_template_directory_uri(); ?>/images/icons.png) no-repeat;background-position: 0px -10px;}
  133. .catag_list a{background:url(<?php echo get_template_directory_uri(); ?>/images/icons.png) no-repeat; background-position: 0px -37px;}
  134. .tag_list a{background:url(<?php echo get_template_directory_uri(); ?>/images/icons.png) no-repeat; background-position: 0px -25px;}
  135. .post-edit-link{background:url(<?php echo get_template_directory_uri(); ?>/images/icons.png) no-repeat; background-position: 0px -49px;}
  136. .comment-reply-link{ background:url(<?php echo get_template_directory_uri(); ?>/images/icons.png) no-repeat; background-position:0px -63px;}
  137. .comment-edit-link{background:url(<?php echo get_template_directory_uri(); ?>/images/icons.png) no-repeat; background-position:0px -49px; }
  138. #sidebar .widget_archive li, #sidebar .widget_meta li, #sidebar .widget_recent_entries li, #sidebar .widget_nav_menu li, #sidebar .widget_recent_comments li, #sidebar .widget_pages li, #sidebar .widget_links li, #sidebar .widget_categories li{list-style-image:url(<?php echo get_template_directory_uri(); ?>/images/list_type.png);}
  139. </style>
  140. <?php } ?>
  141.  
  142. <?php /*?>ICON TPPE 2<?php */?>
  143. <?php if(of_get_option('icons_images') == "icons2"){ ?>
  144. <style type="text/css">
  145. body .comm_date{ background:url(<?php echo get_template_directory_uri(); ?>/images/icons.png) no-repeat;background-position: 0px -84px;}
  146. body .meta_auth{ background:url(<?php echo get_template_directory_uri(); ?>/images/icons.png) no-repeat;background-position: 0px -98px;}
  147. body .tag_list a{background:url(<?php echo get_template_directory_uri(); ?>/images/icons.png) no-repeat; background-position: 0px -111px;}
  148. body .catag_list a{background:url(<?php echo get_template_directory_uri(); ?>/images/icons.png) no-repeat; background-position: 0px -123px;}
  149. body .post-edit-link{background:url(<?php echo get_template_directory_uri(); ?>/images/icons.png) no-repeat; background-position: 0px -135px;}
  150. body .comment-reply-link{ background:url(<?php echo get_template_directory_uri(); ?>/images/icons.png) no-repeat; background-position:0px -146px;}
  151. body .comment-edit-link{background:url(<?php echo get_template_directory_uri(); ?>/images/icons.png) no-repeat; background-position:0px -135px; }
  152. #sidebar .widget_archive li, #sidebar .widget_meta li, #sidebar .widget_recent_entries li, #sidebar .widget_nav_menu li, #sidebar .widget_recent_comments li, #sidebar .widget_pages li, #sidebar .widget_links li, #sidebar .widget_categories li{list-style-image:url(<?php echo get_template_directory_uri(); ?>/images/list_type2.png);}
  153. </style>
  154. <?php } ?>
  155.  
  156. <?php /*?>ICON TPPE 3<?php */?>
  157. <?php if(of_get_option('icons_images') == "icons3"){ ?>
  158. <style type="text/css">
  159. body .comm_date{ background:url(<?php echo get_template_directory_uri(); ?>/images/icons.png) no-repeat;background-position: 0px -169px;}
  160. body .meta_auth{ background:url(<?php echo get_template_directory_uri(); ?>/images/icons.png) no-repeat;background-position: 0px -182px;}
  161. body .tag_list a{background:url(<?php echo get_template_directory_uri(); ?>/images/icons.png) no-repeat; background-position: 0px -195px;}
  162. body .catag_list a{background:url(<?php echo get_template_directory_uri(); ?>/images/icons.png) no-repeat; background-position: 0px -208px;}
  163. body .post-edit-link{background:url(<?php echo get_template_directory_uri(); ?>/images/icons.png) no-repeat; background-position: 0px -220px;}
  164. body .comment-reply-link{ background:url(<?php echo get_template_directory_uri(); ?>/images/icons.png) no-repeat; background-position:0px -234px;}
  165. body .comment-edit-link{background:url(<?php echo get_template_directory_uri(); ?>/images/icons.png) no-repeat; background-position:0px -219px; }
  166. #sidebar .widget_archive li, #sidebar .widget_meta li, #sidebar .widget_recent_entries li, #sidebar .widget_nav_menu li, #sidebar .widget_recent_comments li, #sidebar .widget_pages li, #sidebar .widget_links li, #sidebar .widget_categories li{list-style-image:url(<?php echo get_template_directory_uri(); ?>/images/list_type3.png);}
  167. </style>
  168. <?php } ?>
  169. <?php /*?>BOX SHADOW<?php */?>
  170. <style type="text/css">
  171. .header1 .logo, #thn_welcom, .midrow_blocks, .lay1 .hentry, .lay2 .hentry, .lay3 .hentry, .lay4 .hentry, #footer, .single_wrap .single_post, #newslider, #sidebar .widgets .widget, .comments_template, .search_term{box-shadow:0px 0px 2px rgba(0, 0, 0, <?php echo of_get_option('shdow_text', '0.1'); ?>);-moz-box-shadow:0px 0px 2px rgba(0, 0, 0, <?php echo of_get_option('shdow_text', '0.1'); ?>); -webkit-box-shadow:0px 0px 2px rgba(0, 0, 0, <?php echo of_get_option('shdow_text', '0.1'); ?>);}
  172. </style>
  173.  
  174.  
  175. <?php /*?>Custom FONT Size */?>
  176. <?php if(of_get_option('fontszlet_checkbox') == "1"){ ?>
  177. <style type="text/css">
  178. body .logo h1 a{ font-size:<?php echo of_get_option('logosz_text'); ?>!important; font-weight:normal!important;}
  179. body #topmenu ul li a{ font-size:<?php echo of_get_option('mnusz_text'); ?>!important;}
  180. body .post_content h2 a, .midrow_block h3, .single_wrap .postitle a{ font-size:<?php echo of_get_option('postsz_text'); ?>!important;}
  181. #sidebar .widgettitle, #sidebar .widgettitle a, #footer .widgets .widgettitle, #footer .widgets .widgettitle a, .commentlist .commentmetadata, .commentlist .commentmetadata a, #newslider_home ul#tabs_home li a h4, ul#tabs li a, .comments_template #comments, #comments_ping{font-size:<?php echo of_get_option('othdngsz_text'); ?>!important;}
  182. </style>
  183. <?php } ?>
  184.  
  185. <?php if(of_get_option('nivothumb_checkbox') == "1"){ ?>
  186. <style type="text/css">
  187. .nivo-controlNav{ display:none;}
  188.  
  189. </style>
  190. <?php } ?>
  191.  
  192. <?php }
  193.  
  194. add_action( 'wp_head', 'thn_customstyle' );
  195.  
  196.  
  197.  
  198. //Load Java Scripts to header
  199. function thn_head_js() {
  200. if ( !is_admin() ) {
  201. wp_enqueue_script('jquery');
  202. wp_enqueue_script('thn_js',get_template_directory_uri().'/theron.js');
  203. wp_enqueue_script('thn_other',get_template_directory_uri().'/js/other.js');
  204. wp_enqueue_script('thn_newsslider',get_template_directory_uri().'/js/featureList.js');
  205. if(of_get_option('slider_select') == "accordion"){ wp_enqueue_script('thn_accordion',get_template_directory_uri().'/js/accordion.js');}
  206. if(of_get_option('slider_select') == "nivo"){ wp_enqueue_script('thn_nivo',get_template_directory_uri().'/js/jquery.nivo.js');}
  207. if(of_get_option('disslight_checkbox') == "0"){ wp_enqueue_script('thn_fancybox',get_template_directory_uri().'/js/fancybox.js'); }
  208.  
  209. }
  210. }
  211. add_action('wp_enqueue_scripts', 'thn_head_js');
  212.  
  213. //Load Java Scripts to Footer
  214. add_action('wp_footer', 'thn_load_js');
  215.  
  216. function thn_load_js() { ?>
  217.  
  218. <?php if(of_get_option('slider_select') == "newsslider"){ ?>
  219. <script type="text/javascript">
  220. /* <![CDATA[ */
  221. jQuery(document).ready(function() {
  222. jQuery('#tabs_home li a').featureList({
  223. output : '#output_home li',
  224. start_item : 1,
  225. transition_interval: <?php echo of_get_option('sliderspeed_text'); ?>,
  226. pause_on_hover : true
  227. });
  228.  
  229. jQuery(function(){
  230. jQuery('#tabs_home').totemticker({
  231. row_height : '102px',
  232. next : '#ticker-next',
  233. previous : '#ticker-previous',
  234. stop : '#stop',
  235. start : '#start',
  236. mousestop : true,
  237. interval : <?php echo of_get_option('sliderspeed_text'); ?>
  238. });
  239. });
  240. });
  241. /* ]]> */
  242. </script>
  243. <?php } ?>
  244. <?php if(of_get_option('slider_select') == "accordion"){ ?>
  245. <script type="text/javascript">
  246. /* <![CDATA[ */
  247. jQuery().ready(function() {
  248.  
  249. if (jQuery(window).width() > 500) {
  250. jQuery('.kwicks').kwicks({maxSize : '70%', behavior: 'menu', spacing: 0});
  251. } else {
  252. jQuery(".kwicks .dlthref").attr("href", "#");
  253. var index = jQuery('.kwicks').kwicks({maxSize : '70%', spacing: 0, behavior: 'slideshow'});
  254. jQuery('.kwicks').kwicks('select', 1);
  255. }
  256.  
  257. });
  258. /* ]]> */
  259. </script>
  260. <?php } ?>
  261. <?php if(of_get_option('slider_select') == "nivo"){ ?>
  262. <script type="text/javascript">
  263. jQuery(window).load(function() {
  264.  
  265. if(jQuery.support.touch){
  266. jQuery('#zn_nivo').nivoSlider({
  267. effect: 'slideInLeft',
  268. animSpeed: 250, // Slide transition speed
  269. pauseTime: <?php echo of_get_option('sliderspeed_text'); ?> // How long each slide will show
  270. });
  271.  
  272. jQuery('a.nivo-nextNav').css('visibility', 'hidden');
  273. jQuery('a.nivo-prevNav').css('visibility', 'hidden');
  274.  
  275. //Then Finish Up swipeleft and swiperight
  276. jQuery('#zn_nivo').bind( 'swipeleft', function( e ) {
  277. jQuery('#zn_nivo img').attr("data-transition","slideInLeft");
  278. jQuery('a.nivo-nextNav').trigger('click');
  279. e.stopImmediatePropagation();
  280. return false; }
  281. );
  282.  
  283. jQuery('#zn_nivo').bind( 'swiperight', function( e ) {
  284. jQuery('#zn_nivo img').attr("data-transition","slideInRight");
  285. jQuery('a.nivo-prevNav').trigger('click');
  286. e.stopImmediatePropagation();
  287. return false; }
  288.  
  289. );
  290.  
  291. } else {
  292.  
  293. jQuery('#zn_nivo').nivoSlider({effect: 'random', pauseTime: <?php echo of_get_option('sliderspeed_text'); ?>, controlNavThumbs: true,<?php if(of_get_option('nivothumb_checkbox') == "1"){ ?> directionNav: false,<?php } ?> controlNavThumbsReplace: '-150x150.jpg', pauseOnHover: true});}
  294. });
  295. </script>
  296. <?php } ?>
  297. <?php if(of_get_option('stickm_checkbox') == "1"){ ?>
  298. <script type="text/javascript">
  299. /* <![CDATA[ */
  300. //Sticky MENU
  301. jQuery(window).load(function($) {
  302. if (jQuery(window).width() > 500) {
  303. if (jQuery("body").hasClass('logged-in')) {
  304. jQuery("#menu_wrap").sticky({topSpacing:27});
  305. }
  306. else {
  307. jQuery("#menu_wrap").sticky({topSpacing:0});
  308. }
  309. jQuery("#menu_wrap").css({"z-index":"11"});
  310. }
  311. });
  312. /* ]]> */
  313. </script>
  314. <?php } ?>
  315. <?php if(of_get_option('dissrltd_checkbox') == "0"){ ?>
  316. <script type="text/javascript">
  317. /* <![CDATA[ */
  318. jQuery(document).ready(function() {
  319. jQuery('#tabs li:eq(3), #tabs li:eq(4), #tabs li:eq(5), #tabs li:eq(6)').remove();
  320. var n = jQuery("#tabs li").length;
  321. if (n > 1) {
  322. jQuery('#tabs li a').featureList({
  323. output : '#output li',
  324. start_item : 1,
  325. transition_interval: 3000,
  326. pause_on_hover : true
  327. });
  328. }
  329. });
  330. /* ]]> */
  331. </script>
  332.  
  333. <?php } ?>
  334.  
  335. <script type="text/javascript">
  336. /* <![CDATA[ */
  337. jQuery().ready(function() {
  338.  
  339. jQuery('#topmenu').prepend('<div id="menu-icon"><?php _e('Menu', 'theron') ?></div>');
  340. jQuery("#menu-icon").on("click", function(){
  341. jQuery("#topmenu ul.menu, #topmenu div.menu ul").slideToggle();
  342. jQuery(this).toggleClass("menu_active");
  343. });
  344.  
  345. });
  346. /* ]]> */
  347. </script>
  348.  
  349. <?php }
  350.  
  351. //theron get the first image of the post Function
  352. function thn_get_images($overrides = '', $exclude_thumbnail = false)
  353. {
  354. return get_posts(wp_parse_args($overrides, array(
  355. 'numberposts' => -1,
  356. 'post_parent' => get_the_ID(),
  357. 'post_type' => 'attachment',
  358. 'post_mime_type' => 'image',
  359. 'order' => 'ASC',
  360. 'exclude' => $exclude_thumbnail ? array(get_post_thumbnail_id()) : array(),
  361. 'orderby' => 'menu_order ID'
  362. )));
  363. }
  364.  
  365. //VIDEO THUMBNAIL
  366. function thn_get_custom_field_value($szKey, $bPrint = false) {
  367. global $post;
  368. $szValue = get_post_meta($post->ID, $szKey, true);
  369. if ( $bPrint == false ) return $szValue; else echo $szValue;
  370. }
  371.  
  372. add_action('publish_page', 'add_custom_field_automatically');
  373. add_action('publish_post', 'add_custom_field_automatically');
  374. function add_custom_field_automatically($post_ID) {
  375. global $wpdb;
  376. if(!wp_is_post_revision($post_ID)) {
  377. add_post_meta($post_ID, 'videolink', '', true);
  378. }
  379. }
  380.  
  381.  
  382.  
  383. // Change what's hidden by default
  384. add_filter('default_hidden_meta_boxes', 'thn_hidden_meta_boxes', 10, 2);
  385. function thn_hidden_meta_boxes($hidden, $screen) {
  386. if ( 'post' == $screen->base || 'page' == $screen->base || 'slider' == $screen->base )
  387. $hidden = array('slugdiv', 'trackbacksdiv', 'commentstatusdiv', 'commentsdiv', 'authordiv', 'revisionsdiv');
  388. // removed 'postcustom',
  389. return $hidden;
  390. }
  391.  
  392. //ADD FULL WIDTH BODY CLASS
  393. add_filter( 'body_class', 'thn_fullwdth_body_class');
  394. function thn_fullwdth_body_class( $classes ) {
  395. if(of_get_option('nosidebar_checkbox') == "1")
  396. $classes[] = 'thn_fullwdth_body';
  397. return $classes;
  398. }
  399.  
  400. //Custom Excerpt Length
  401. function thn_excerptlength_teaser($length) {
  402. return 30;
  403. }
  404. function thn_excerptlength_index($length) {
  405. return 12;
  406. }
  407. function thn_excerptmore($more) {
  408. return '...';
  409. }
  410.  
  411. function thn_excerpt($length_callback='', $more_callback='') {
  412. global $post;
  413. if(function_exists($length_callback)){
  414. add_filter('excerpt_length', $length_callback);
  415. }
  416. if(function_exists($more_callback)){
  417. add_filter('excerpt_more', $more_callback);
  418. }
  419. $output = get_the_excerpt();
  420. $output = apply_filters('wptexturize', $output);
  421. $output = apply_filters('convert_chars', $output);
  422. $output = '<p>'.$output.'</p>';
  423. echo $output;
  424. }
  425.  
  426. //SIDEBAR
  427. function thn_widgets_init(){
  428. register_sidebar(array(
  429. 'name' => __('Right Sidebar', 'theron'),
  430. 'id' => 'sidebar',
  431. 'description' => __('Right Sidebar', 'theron'),
  432. 'before_widget' => '<li id="%1$s" class="widget %2$s"><div class="widget_wrap">',
  433. 'after_widget' => '</div>',
  434. 'before_title' => '<h3 class="widgettitle">',
  435. 'after_title' => '</h3>'
  436. ));
  437.  
  438. register_sidebar(array(
  439. 'name' => __('Footer Widgets', 'theron'),
  440. 'id' => 'foot_sidebar',
  441. 'description' => __('Widget Area for the Footer', 'theron'),
  442. 'before_widget' => '<li id="%1$s" class="widget %2$s"><div class="widget_wrap">',
  443. 'after_widget' => '</div>',
  444. 'before_title' => '<h3 class="widgettitle">',
  445. 'after_title' => '</h3>'
  446. ));
  447. }
  448.  
  449. add_action( 'widgets_init', 'thn_widgets_init' );
  450.  
  451.  
  452. //theron COMMENTS
  453. function thn_comment($comment, $args, $depth) {
  454. $GLOBALS['comment'] = $comment; ?>
  455. <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
  456.  
  457. <div id="comment-<?php comment_ID(); ?>" class="comment-body">
  458. <div class="comment-author vcard">
  459. <div class="avatar"><?php echo get_avatar($comment,$size='50' ); ?></div>
  460. </div>
  461. <div class="comment-meta commentmetadata">
  462. <?php printf(__('%s', 'theron'), get_comment_author_link()) ?> <span><?php _e('says:', 'theron') ?></span>
  463. </div>
  464. <?php if ($comment->comment_approved == '0') : ?>
  465. <em><?php _e('Your comment is awaiting moderation.', 'theron') ?></em>
  466. <br />
  467. <?php endif; ?>
  468.  
  469. <div class="org_comment"><?php comment_text() ?>
  470.  
  471. <div class="comm_meta_reply">
  472. <a class="comm_date"><?php printf(get_comment_date()) ?></a>
  473. <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
  474. <?php edit_comment_link(__('Edit', 'theron'),' ','') ?></div>
  475. </div>
  476.  
  477. </div>
  478. <?php
  479. }
  480.  
  481. //theron TRACKBACKS & PINGS
  482. function thn_ping($comment, $args, $depth) {
  483.  
  484. $GLOBALS['comment'] = $comment; ?>
  485.  
  486. <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
  487.  
  488. <div id="comment-<?php comment_ID(); ?>" class="comment-body">
  489. <?php if ($comment->comment_approved == '0') : ?>
  490. <em><?php _e('Your comment is awaiting moderation.', 'theron') ?></em>
  491. <br />
  492. <?php endif; ?>
  493.  
  494. <div class="org_ping">
  495. <?php printf(__('<cite class="citeping">%s</cite> <span class="says">:</span>'), get_comment_author_link()) ?>
  496. <?php comment_text() ?>
  497. <div class="comm_meta_reply">
  498. <a class="comm_date"><?php printf(get_comment_date()) ?></a>
  499. <?php edit_comment_link(__('Edit', 'theron'),' ','') ?></div>
  500. </div>
  501. </div>
  502.  
  503.  
  504. <?php }
  505.  
  506. //Add Custom Slider Post
  507. add_action('init', 'thn_slider_register');
  508.  
  509. function thn_slider_register() {
  510.  
  511. $labels = array(
  512. 'name' => __('Slider', 'theron'),
  513. 'singular_name' => __('Slider Item', 'theron'),
  514. 'add_new' => __('Add New', 'theron'),
  515. 'add_new_item' => __('Add New Slide', 'theron'),
  516. 'edit_item' => __('Edit Slides', 'theron'),
  517. 'new_item' => __('New Slider', 'theron'),
  518. 'view_item' => __('View Sliders', 'theron'),
  519. 'search_items' => __('Search Sliders', 'theron'),
  520. 'menu_icon' => get_stylesheet_directory_uri() . 'images/article16.png',
  521. 'not_found' => __('Nothing found', 'theron'),
  522. 'not_found_in_trash' => __('Nothing found in Trash', 'theron'),
  523. 'parent_item_colon' => ''
  524. );
  525.  
  526. $args = array(
  527. 'labels' => $labels,
  528. 'public' => true,
  529. 'exclude_from_search' => true,
  530. 'publicly_queryable' => true,
  531. 'show_ui' => true,
  532. 'query_var' => true,
  533. 'menu_icon' => get_stylesheet_directory_uri() . '/images/slides.png',
  534. 'rewrite' => false,
  535. 'capability_type' => 'post',
  536. 'hierarchical' => false,
  537. 'menu_position' => null,
  538. 'supports' => array('title','excerpt','thumbnail'),
  539. 'register_meta_box_cb' => 'thn_add_meta'
  540. );
  541.  
  542. register_post_type( 'slider' , $args );
  543. }
  544. //Slider Link Meta Box
  545. add_action("admin_init", "thn_add_meta");
  546.  
  547. function thn_add_meta(){
  548. add_meta_box("thn_credits_meta", "Link", "thn_credits_meta", "slider", "normal", "low");
  549. }
  550.  
  551.  
  552. function thn_credits_meta( $post ) {
  553.  
  554. // Use nonce for verification
  555. $thndata = get_post_meta($post->ID, 'thn_slide_link', TRUE);
  556. wp_nonce_field( 'thn_meta_box_nonce', 'meta_box_nonce' );
  557.  
  558. // The actual fields for data entry
  559. echo '<input type="text" id="thn_sldurl" name="thn_sldurl" value="'.$thndata.'" size="75" />';
  560. }
  561.  
  562. //Save Slider Link Value
  563. add_action('save_post', 'thn_save_details');
  564. function thn_save_details($post_id){
  565. if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
  566. return;
  567.  
  568. if( !isset( $_POST['meta_box_nonce'] ) || !wp_verify_nonce( $_POST['meta_box_nonce'], 'thn_meta_box_nonce' ) ) return;
  569.  
  570. if ( !current_user_can( 'edit_post', $post_id ) )
  571. return;
  572.  
  573. $thndata = esc_url( $_POST['thn_sldurl'] );
  574. update_post_meta($post_id, 'thn_slide_link', $thndata);
  575. return $thndata;
  576. }
  577.  
  578.  
  579.  
  580. add_action('do_meta_boxes', 'thn_slider_image_box');
  581.  
  582. function thn_slider_image_box() {
  583. remove_meta_box( 'postimagediv', 'slider', 'side' );
  584. add_meta_box('postimagediv', __('Slide Image', 'theron'), 'post_thumbnail_meta_box', 'slider', 'normal', 'high');
  585. }
  586.  
  587. /*
  588. * Loads the Options Panel
  589. */
  590.  
  591.  
  592.  
  593. /* Set the file path based on whether we're in a child theme or parent theme */
  594.  
  595. if ( STYLESHEETPATH != TEMPLATEPATH ) {
  596. define('OPTIONS_FRAMEWORK_URL', TEMPLATEPATH . '/admin/');
  597. define('OPTIONS_FRAMEWORK_DIRECTORY', get_template_directory_uri() . '/admin/');
  598. } else {
  599. define('OPTIONS_FRAMEWORK_URL', STYLESHEETPATH . '/admin/');
  600. define('OPTIONS_FRAMEWORK_DIRECTORY', get_stylesheet_directory_uri() . '/admin/');
  601. }
  602.  
  603. require_once (OPTIONS_FRAMEWORK_URL . 'options-framework.php');
  604.  
  605. include(get_template_directory() . '/lib/script/pagination.php');
  606. include(get_template_directory() . '/lib/includes/shortcodes.php');
  607. include(get_template_directory() . '/lib/includes/widgets.php');
  608. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement