Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.84 KB | None | 0 0
  1. <?php
  2.  
  3. if ( ! isset( $content_width ) )
  4. $content_width = 630;
  5.  
  6.  
  7. //Load Mobile CSS
  8. function theron_mobile_css() {
  9. if ( !is_admin() ) {
  10. wp_enqueue_style( 'theron_mobile', get_template_directory_uri() . '/mobile.css', false, '1.0', 'only screen and (max-width: 480px)' );
  11. wp_enqueue_style( 'theron_pad', get_template_directory_uri() . '/pad.css', false, '1.0', 'screen and (min-width: 500px) and (max-width: 800px)' );
  12. }
  13. }
  14. add_action('wp_enqueue_scripts', 'theron_mobile_css');
  15.  
  16.  
  17.  
  18. //Load Other CSS files
  19. function theron_other_css() {
  20. if ( !is_admin() ) {
  21. if(of_get_option('disslight_checkbox') == "0"){ ?><?php wp_enqueue_style('fancybox',get_template_directory_uri().'/css/fancybox.css'); }
  22. 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'); }
  23. }
  24. }
  25. add_action('wp_enqueue_scripts', 'theron_other_css');
  26.  
  27.  
  28. //Load Custom CSS
  29. function theron_customstyle() { ?>
  30.  
  31. <?php if(of_get_option('sldrtxt_checkbox') == "0"){ ?> <style type="text/css">body .nivo-caption{ display:none!important;}</style><?php } ?>
  32.  
  33.  
  34. <?php /*?>ROUNDED CORNER<?php */?>
  35. <?php if(of_get_option('rounded_checkbox') == "1"){ ?>
  36. <style type="text/css">
  37. .skew_bottom_big, .skew_bottom_right, .skew_top_big, .skew_top_right, .single_skew, .single_skew .skew_bottom_big, .single_skew .skew_bottom_right, .depth-1 .single_skew, .single_skew_comm, .single_skew_comm .skew_top_big, .single_skew_comm .skew_top_right, #respond_wrap .single_skew, #respond_wrap .single_skew_comm{display:none!important;}
  38. .commentlist .depth-1{ margin-top:10px;}
  39. .midrow_blocks{overflow:hidden;}
  40.  
  41. <?php if(of_get_option('slider_select') == "noslider"){ ?>
  42. 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);}
  43. 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);}
  44. .slide_shadow{ display:none;}
  45. <?php } ?>
  46.  
  47. .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);}
  48.  
  49. .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);}
  50.  
  51. .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);}
  52.  
  53. #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);}
  54. #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);}
  55. #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);}
  56. #copyright{ margin-top:20px;}
  57. </style>
  58. <?php } ?>
  59.  
  60.  
  61. <?php if(of_get_option('nivothumb_checkbox') == "0"){ ?>
  62. <style type="text/css">
  63. .nivo-controlNav{ display:none;}
  64. </style>
  65. <?php } ?>
  66. <style type="text/css">
  67. /*Secondary Elements Color*/
  68. #newslider_home ul#tabs_home li a.current, #newslider_home .news_buttn, .midrow_block:hover, .lay1 .catmeta, .lay4 .catmeta, #wp-calendar #today, .form-submit input, #searchsubmit, .single_post .scl_button a, .entry-content #submit_msg, .amp_current, .amp_current:hover{ background:<?php echo of_get_option('secelm_colorpicker'); ?>!important;}
  69.  
  70. .lay1 .postitle a:hover, .lay2 .postitle a:hover, .lay3 .postitle a:hover, .lay4 .postitle a:hover, .lay5 .postitle a:hover, .thn_twitter .tweet_text a, .widget_tag_cloud a:hover, .textwidget a, #newslider h3, ul#tabs li a:hover, .comments_template #comments a, .commentmetadata, .commentmetadata a, .org_comment a, .org_ping a, h3#reply-title, .logged-in-as a, .archive-template ul li a:hover, .single_wrap .thn_post_wrap a, #footer .widgets .widgettitle, #midrow .widgets .widgettitle a{color:<?php echo of_get_option('secelm_colorpicker'); ?>!important;}
  71.  
  72. .nivo-caption, .lay2 .post_content, #sidebar .widgettitle, #sidebar .widgettitle a {border-color:<?php echo of_get_option('secelm_colorpicker'); ?>;}
  73. #topmenu{ border-bottom-color:<?php echo of_get_option('secelm_colorpicker'); ?>!important;}
  74.  
  75. body #topmenu ul > li ul li:hover, .menu_active{ background:<?php echo of_get_option('secelm_colorpicker'); ?>
  76. <?php if(of_get_option('pattrndiss_checkbox') == "0"){ ?> url("<?php echo get_template_directory_uri(); ?>/images/pattern.png") repeat<?php } ?>!important;}
  77.  
  78. <?php if(of_get_option('pattrndiss_checkbox') == "1"){ ?>
  79. #header, #topmenu ul li ul li, .lay2 .post_content, #copyright, body #topmenu ul > li ul li:hover{ background-image:none!important;}
  80. body #menu_wrap, #topmenu ul li ul li{ background:#302F2F url("<?php echo get_template_directory_uri(); ?>/images/transblack.png") repeat!important;}
  81. <?php } ?>
  82.  
  83. /*TEXT COLOR ON SECONDARY ELEMENTS*/
  84. .midrow_block:hover h3, .form-submit input, #searchsubmit, #topmenu ul > li ul li:hover > a, .lay1 .catmeta a, .lay4 .catmeta a, .amp_current, .entry-content #submit_msg, .single_post .scl_button a, #topmenu ul li ul li:hover a, .midrow_block:hover, #menu-icon{color:<?php echo of_get_option('secelmtxt_colorpicker'); ?>!important;}
  85.  
  86. </style>
  87. <?php }
  88.  
  89. add_action( 'wp_head', 'theron_customstyle' );
  90.  
  91.  
  92.  
  93. //Load Java Scripts to header
  94. function theron_head_js() {
  95. if ( !is_admin() ) {
  96. wp_enqueue_script('jquery');
  97. wp_enqueue_script('theron_js',get_template_directory_uri().'/theron.js');
  98. wp_enqueue_script('theron_other',get_template_directory_uri().'/js/other.js');
  99. if(of_get_option('slider_select') == "nivo"){ wp_enqueue_script('theron_nivo',get_template_directory_uri().'/js/jquery.nivo.js');}
  100. if(of_get_option('disslight_checkbox') == "0"){ wp_enqueue_script('theron_fancybox',get_template_directory_uri().'/js/fancybox.js'); }
  101. if ( is_singular() ) wp_enqueue_script( 'comment-reply' );
  102. }
  103. }
  104. add_action('wp_enqueue_scripts', 'theron_head_js');
  105.  
  106. //Load Java Scripts to Footer
  107. add_action('wp_footer', 'theron_load_js');
  108.  
  109. function theron_load_js() { ?>
  110.  
  111. <?php if(of_get_option('slider_select') == "nivo"){ ?>
  112.  
  113. <script type="text/javascript">
  114.  
  115. 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', effect: 'fade'});
  116. jQuery('.nivo-caption:empty').hide();
  117.  
  118. </script>
  119.  
  120. <?php } ?>
  121. <?php if(of_get_option('stickm_checkbox') == "1"){ ?>
  122. <script type="text/javascript">
  123. /* <![CDATA[ */
  124. //Sticky MENU
  125. jQuery(window).load(function($) {
  126. if (jQuery("body").hasClass('logged-in')) {
  127. jQuery("#menu_wrap").sticky({topSpacing:27});
  128. }
  129. else {
  130. jQuery("#menu_wrap").sticky({topSpacing:0});
  131. }
  132. jQuery("#menu_wrap").css({"z-index":"11"});
  133.  
  134. });
  135. /* ]]> */
  136. </script>
  137. <?php } ?>
  138.  
  139. <script type="text/javascript">
  140. /* <![CDATA[ */
  141. jQuery().ready(function() {
  142.  
  143. jQuery('#topmenu').prepend('<div id="menu-icon"><?php _e('Meny', 'theron') ?></div>');
  144. jQuery("#menu-icon").on("click", function(){
  145. jQuery("#topmenu .menu").slideToggle();
  146. jQuery(this).toggleClass("menu_active");
  147. });
  148.  
  149. });
  150. /* ]]> */
  151. </script>
  152.  
  153. <?php }
  154.  
  155. //theron get the first image of the post Function
  156. function theron_get_images($overrides = '', $exclude_thumbnail = false)
  157. {
  158. return get_posts(wp_parse_args($overrides, array(
  159. 'numberposts' => -1,
  160. 'post_parent' => get_the_ID(),
  161. 'post_type' => 'attachment',
  162. 'post_mime_type' => 'image',
  163. 'order' => 'ASC',
  164. 'exclude' => $exclude_thumbnail ? array(get_post_thumbnail_id()) : array(),
  165. 'orderby' => 'menu_order ID'
  166. )));
  167. }
  168.  
  169.  
  170.  
  171. // Change what's hidden by default
  172. add_filter('default_hidden_meta_boxes', 'theron_hidden_meta_boxes', 10, 2);
  173. function theron_hidden_meta_boxes($hidden, $screen) {
  174. if ( 'post' == $screen->base || 'page' == $screen->base || 'slider' == $screen->base )
  175. $hidden = array('slugdiv', 'trackbacksdiv', 'commentstatusdiv', 'commentsdiv', 'authordiv', 'revisionsdiv');
  176. // removed 'postcustom',
  177. return $hidden;
  178. }
  179.  
  180. //ADD FULL WIDTH BODY CLASS
  181. add_filter( 'body_class', 'theron_fullwdth_body_class');
  182. function theron_fullwdth_body_class( $classes ) {
  183. if(of_get_option('nosidebar_checkbox') == "1")
  184. $classes[] = 'theron_fullwdth_body';
  185. return $classes;
  186. }
  187.  
  188. //Custom Excerpt Length
  189. function theron_excerptlength_teaser($length) {
  190. return 30;
  191. }
  192. function theron_excerptlength_index($length) {
  193. return 12;
  194. }
  195. function theron_excerptmore($more) {
  196. return '...';
  197. }
  198.  
  199. function theron_excerpt($length_callback='', $more_callback='') {
  200. global $post;
  201. if(function_exists($length_callback)){
  202. add_filter('excerpt_length', $length_callback);
  203. }
  204. if(function_exists($more_callback)){
  205. add_filter('excerpt_more', $more_callback);
  206. }
  207. $output = get_the_excerpt();
  208. $output = apply_filters('wptexturize', $output);
  209. $output = apply_filters('convert_chars', $output);
  210. $output = '<p>'.$output.'</p>';
  211. echo $output;
  212. }
  213.  
  214. //SIDEBAR
  215. function theron_widgets_init(){
  216. register_sidebar(array(
  217. 'name' => __('Right Sidebar', 'theron'),
  218. 'id' => 'sidebar',
  219. 'description' => __('Right Sidebar', 'theron'),
  220. 'before_widget' => '<div id="%1$s" class="widget %2$s"><div class="widget_wrap">',
  221. 'after_widget' => '</div></div>',
  222. 'before_title' => '<h3 class="widgettitle">',
  223. 'after_title' => '</h3>'
  224. ));
  225.  
  226.  
  227. register_sidebar(array(
  228. 'name' => __('Sosiale medier', 'theron'),
  229. 'id' => 'sosialemedier',
  230. 'description' => __('Widget Area for the Footer', 'theron'),
  231. 'before_widget' => '<div id="%1$s" class="widget %2$s"><div class="widget_wrap">',
  232. 'after_widget' => '</div></div>',
  233. 'before_title' => '<h3 class="widgettitle">',
  234. 'after_title' => '</h3>'
  235. ));
  236.  
  237. register_sidebar(array(
  238. 'name' => __('Kortinfo', 'theron'),
  239. 'id' => 'foot_sidebar2',
  240. 'description' => __('Widget Area for the Footer', 'theron'),
  241. 'before_widget' => '<div id="%1$s" class="widget %2$s"><div class="widget_wrap">',
  242. 'after_widget' => '</div></div>',
  243. 'before_title' => '<h3 class="widgettitle">',
  244. 'after_title' => '</h3>'
  245. ));
  246.  
  247. register_sidebar(array(
  248. 'name' => __('Footer Widgets', 'theron'),
  249. 'id' => 'foot_sidebar',
  250. 'description' => __('Widget Area for the Footer', 'theron'),
  251. 'before_widget' => '<div id="%1$s" class="widget %2$s"><div class="widget_wrap">',
  252. 'after_widget' => '</div></div>',
  253. 'before_title' => '<h3 class="widgettitle">',
  254. 'after_title' => '</h3>'
  255. ));
  256. }
  257.  
  258. add_action( 'widgets_init', 'theron_widgets_init' );
  259.  
  260.  
  261. //theron COMMENTS
  262. function theron_comment($comment, $args, $depth) {
  263. $GLOBALS['comment'] = $comment; ?>
  264. <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
  265.  
  266. <div id="comment-<?php comment_ID(); ?>" class="comment-body">
  267. <div class="comment-author vcard">
  268. <div class="avatar"><?php echo get_avatar($comment,$size='50' ); ?></div>
  269. </div>
  270. <div class="comment-meta commentmetadata">
  271. <?php printf(__('%s', 'theron'), get_comment_author_link()) ?> <span><?php _e('says:', 'theron') ?></span>
  272. </div>
  273. <?php if ($comment->comment_approved == '0') : ?>
  274. <em><?php _e('Your comment is awaiting moderation.', 'theron') ?></em>
  275. <br />
  276. <?php endif; ?>
  277.  
  278. <div class="org_comment"><?php comment_text() ?>
  279.  
  280. <div class="comm_meta_reply">
  281. <a class="comm_date"><?php printf(get_comment_date()) ?></a>
  282. <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
  283. <?php edit_comment_link(__('Edit', 'theron'),' ','') ?></div>
  284. </div>
  285.  
  286. </div>
  287. <?php
  288. }
  289.  
  290. //**************TRACKBACKS & PINGS******************//
  291. function theron_ping($comment, $args, $depth) {
  292.  
  293. $GLOBALS['comment'] = $comment; ?>
  294.  
  295. <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
  296.  
  297. <div id="comment-<?php comment_ID(); ?>" class="comment-body">
  298. <?php if ($comment->comment_approved == '0') : ?>
  299. <em><?php _e('Your comment is awaiting moderation.', 'theron') ?></em>
  300. <br />
  301. <?php endif; ?>
  302.  
  303. <div class="org_ping">
  304. <?php printf(__('<cite class="citeping">%s</cite> <span class="says">:</span>'), get_comment_author_link()) ?>
  305. <?php comment_text() ?>
  306. <div class="comm_meta_reply">
  307. <a class="comm_date"><?php printf(get_comment_date()) ?></a>
  308. <?php edit_comment_link(__('Edit', 'theron'),' ','') ?></div>
  309. </div>
  310. </div>
  311.  
  312.  
  313. <?php }
  314.  
  315. //**************SLIDER SETUP******************//
  316. add_action('init', 'theron_slider_register');
  317.  
  318. function theron_slider_register() {
  319.  
  320. $labels = array(
  321. 'name' => __('Slider', 'theron'),
  322. 'singular_name' => __('Slider Item', 'theron'),
  323. 'add_new' => __('Add New', 'theron'),
  324. 'add_new_item' => __('Add New Slide', 'theron'),
  325. 'edit_item' => __('Edit Slides', 'theron'),
  326. 'new_item' => __('New Slider', 'theron'),
  327. 'view_item' => __('View Sliders', 'theron'),
  328. 'search_items' => __('Search Sliders', 'theron'),
  329. 'menu_icon' => get_stylesheet_directory_uri() . 'images/article16.png',
  330. 'not_found' => __('Nothing found', 'theron'),
  331. 'not_found_in_trash' => __('Nothing found in Trash', 'theron'),
  332. 'parent_item_colon' => ''
  333. );
  334.  
  335. $args = array(
  336. 'labels' => $labels,
  337. 'public' => true,
  338. 'exclude_from_search' => true,
  339. 'publicly_queryable' => true,
  340. 'show_ui' => true,
  341. 'query_var' => true,
  342. 'menu_icon' => get_stylesheet_directory_uri() . '/images/slides.png',
  343. 'rewrite' => false,
  344. 'capability_type' => 'post',
  345. 'hierarchical' => false,
  346. 'menu_position' => null,
  347. 'supports' => array('title','excerpt','thumbnail'),
  348. 'register_meta_box_cb' => 'theron_add_meta'
  349. );
  350.  
  351. register_post_type( 'slider' , $args );
  352. }
  353. //Slider Link Meta Box
  354. add_action("admin_init", "theron_add_meta");
  355.  
  356. function theron_add_meta(){
  357. add_meta_box("theron_credits_meta", "Link", "theron_credits_meta", "slider", "normal", "low");
  358. }
  359.  
  360.  
  361. function theron_credits_meta( $post ) {
  362.  
  363. // Use nonce for verification
  364. $therondata = get_post_meta($post->ID, 'theron_slide_link', TRUE);
  365. wp_nonce_field( 'theron_meta_box_nonce', 'meta_box_nonce' );
  366.  
  367. // The actual fields for data entry
  368. echo '<input type="text" id="theron_sldurl" name="theron_sldurl" value="'.$therondata.'" size="75" />';
  369. }
  370.  
  371. //Save Slider Link Value
  372. add_action('save_post', 'theron_save_details');
  373. function theron_save_details($post_id){
  374. if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
  375. return;
  376.  
  377. if( !isset( $_POST['meta_box_nonce'] ) || !wp_verify_nonce( $_POST['meta_box_nonce'], 'theron_meta_box_nonce' ) ) return;
  378.  
  379. if ( !current_user_can( 'edit_post', $post_id ) )
  380. return;
  381.  
  382. $therondata = esc_url( $_POST['theron_sldurl'] );
  383. update_post_meta($post_id, 'theron_slide_link', $therondata);
  384. return $therondata;
  385. }
  386.  
  387.  
  388.  
  389. add_action('do_meta_boxes', 'theron_slider_image_box');
  390.  
  391. function theron_slider_image_box() {
  392. remove_meta_box( 'postimagediv', 'slider', 'side' );
  393. add_meta_box('postimagediv', __('Slide Image', 'theron'), 'post_thumbnail_meta_box', 'slider', 'normal', 'high');
  394. }
  395.  
  396.  
  397. //**************THERON SETUP******************//
  398. function theron_setup() {
  399. //Custom Background
  400. add_theme_support( 'custom-background', array(
  401. 'default-color' => '',
  402. 'default-image' => get_template_directory_uri() . '/images/theronbg.png'
  403. ) );
  404.  
  405. add_theme_support('automatic-feed-links');
  406.  
  407. //Post Thumbnail
  408. add_theme_support( 'post-thumbnails' );
  409.  
  410.  
  411. //Register Menus
  412. register_nav_menus( array(
  413. 'primary' => __( 'Primary Navigation', 'theron' ),
  414. 'footer' => __( 'Footer Navigation', 'theron' )
  415. ) );
  416.  
  417.  
  418. /*
  419. * Loads the Options Panel
  420. */
  421. /* Set the file path based on whether we're in a child theme or parent theme */
  422.  
  423. if ( get_stylesheet_directory() == get_template_directory_uri() ) {
  424. define('OPTIONS_FRAMEWORK_URL', get_template_directory() . '/admin/');
  425. define('OPTIONS_FRAMEWORK_DIRECTORY', get_template_directory_uri() . '/admin/');
  426. } else {
  427. define('OPTIONS_FRAMEWORK_URL', get_stylesheet_directory() . '/admin/');
  428. define('OPTIONS_FRAMEWORK_DIRECTORY', get_stylesheet_directory_uri() . '/admin/');
  429. }
  430.  
  431. require_once (OPTIONS_FRAMEWORK_URL . 'options-framework.php');
  432.  
  433. include(get_template_directory() . '/lib/script/pagination.php');
  434. include(get_template_directory() . '/lib/includes/shortcodes.php');
  435. include(get_template_directory() . '/lib/includes/widgets.php');
  436.  
  437. }
  438. add_action( 'after_setup_theme', 'theron_setup' );
  439. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement