Advertisement
Guest User

Function.php

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