Advertisement
towfiqi

functions.php

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