/inc/custom-functions.php

  1. <?php 
  2. /** 
  3. * @package SKT Biz 
  4. * Setup the WordPress core custom functions feature. 
  5. * 
  6. */ 
  7. function skt_biz_content($limit) { 
  8. $content = explode(' ', get_the_content(), $limit); 
  9. if (count($content)>=$limit) { 
  10. array_pop($content); 
  11. $content = implode(" ", $content).'...'; 
  12. } else { 
  13. $content = implode(" ", $content); 
  14. }  
  15. $content = preg_replace('/\[.+\]/', '', $content); 
  16. $content = apply_filters('the_content', $content); 
  17. $content = str_replace(']]>', ']]>', $content); 
  18. return $content; 
  19.  
  20. add_action('wp_enqueue_script', 'skt_biz_optionsframework_custom_scripts'); 
  21. function skt_biz_optionsframework_custom_scripts() { 
  22. wp_enqueue_script('skt-biz-custom-admin', get_template_directory_uri().'/js/custom-admin'); 
  23.  
  24. // custom javascript for head 
  25. add_action('wp_head', 'hook_custom_javascript'); 
  26. function hook_custom_javascript() { 
  27. wp_enqueue_script('skt-biz-custom-hook', get_template_directory_uri().'/js/custom-hook.js'); 
  28.  
  29. // get_the_content format text 
  30. function skt_biz_get_the_content_format( $str ) { 
  31. $raw_content = apply_filters( 'the_content', $str ); 
  32. $content = str_replace( ']]>', ']]>', $raw_content ); 
  33. return $content; 
  34. // the_content format text 
  35. function skt_biz_the_content_format( $str ) { 
  36. echo skt_biz_get_the_content_format( $str ); 
  37.  
  38. // subhead section function 
  39. function skt_biz_sub_head_section( $more ) { 
  40. $pgs = 0; 
  41. do { 
  42. $pgs++; 
  43. } while ($more > $pgs); 
  44. return $pgs; 
  45.  
  46.  
  47.  
  48. function skt_biz_excerpt_more( $more ) { 
  49. return '... '; 
  50. add_filter('excerpt_more', 'skt_biz_excerpt_more'); 
  51.  
  52.  
  53. function skt_biz_getPostCategories() { 
  54. $categories = get_the_category(); 
  55. $catOut = ''; 
  56. $separator = ', '; 
  57. $catOutput = ''; 
  58. if($categories) { 
  59. foreach($categories as $category) { 
  60. $catOutput .= '<a href="'.esc_url(get_category_link( $category->term_id )).'" title="' . esc_attr( sprintf( __( "View all posts in %s", 'skt-biz' ), $category->name ) ) . '">'.$category->cat_name.'</a>'.$separator; 
  61. $catOut = 'Categories: '.trim($catOutput, $separator); 
  62. return $catOut; 
  63.  
  64. function str_lreplace($search, $replace, $subject) { 
  65. $pos = strrpos($subject, $search); 
  66. if($pos !== false) { 
  67. $subject = substr_replace($subject, $replace, $pos, strlen($search)); 
  68. return $subject; 
  69.  
  70. define('SKT_THEME_URL_DIRECT', 'http://www.sktthemes.net/themes/skt_biz_pro/'); 
  71. define('SKT_THEME_URL', 'http://sktthemes.net/themes'); 
  72. define('SKT_URL', 'http://sktthemes.net'); 
.