Advertisement
Guest User

Untitled

a guest
Sep 29th, 2015
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.90 KB | None | 0 0
  1. <?php
  2. /**Theme Name : Appointment
  3. * Theme Core Functions and Codes
  4. */
  5. /**Includes reqired resources here**/
  6. define('WEBRITI_TEMPLATE_DIR_URI', get_template_directory_uri());
  7. define('WEBRITI_TEMPLATE_DIR' , get_template_directory());
  8. define('WEBRITI_THEME_FUNCTIONS_PATH' , WEBRITI_TEMPLATE_DIR.'/functions');
  9. require( WEBRITI_THEME_FUNCTIONS_PATH .'/scripts/script.php');
  10. require( WEBRITI_THEME_FUNCTIONS_PATH .'/menu/default_menu_walker.php');
  11. require( WEBRITI_THEME_FUNCTIONS_PATH .'/menu/appoinment_nav_walker.php');
  12. require( WEBRITI_THEME_FUNCTIONS_PATH .'/widgets/sidebars.php');
  13. require( WEBRITI_THEME_FUNCTIONS_PATH .'/widgets/appointment_info_widget.php');
  14. require( WEBRITI_THEME_FUNCTIONS_PATH . '/template-tag.php');
  15. require( WEBRITI_THEME_FUNCTIONS_PATH . '/breadcrumbs/breadcrumbs.php');
  16. require( WEBRITI_THEME_FUNCTIONS_PATH . '/font/font.php');
  17. //Customizer
  18. require( WEBRITI_THEME_FUNCTIONS_PATH . '/customizer/customizer_theme_style.php');
  19. require( WEBRITI_THEME_FUNCTIONS_PATH . '/customizer/customizer-callout.php');
  20. require( WEBRITI_THEME_FUNCTIONS_PATH . '/customizer/customizer-slider.php');
  21. require( WEBRITI_THEME_FUNCTIONS_PATH . '/customizer/customizer-copyright.php');
  22. require( WEBRITI_THEME_FUNCTIONS_PATH . '/customizer/customizer-header.php');
  23. require( WEBRITI_THEME_FUNCTIONS_PATH . '/customizer/customizer-news.php');
  24. require( WEBRITI_THEME_FUNCTIONS_PATH . '/customizer/customizer-service.php');
  25. require( WEBRITI_THEME_FUNCTIONS_PATH . '/customizer/customizer-pro.php');
  26. require( WEBRITI_THEME_FUNCTIONS_PATH . '/customizer/customizer-project.php');
  27. require( WEBRITI_THEME_FUNCTIONS_PATH . '/customizer/customizer-testimonial.php');
  28. require( WEBRITI_THEME_FUNCTIONS_PATH . '/customizer/customizer-client.php');
  29. require( WEBRITI_THEME_FUNCTIONS_PATH . '/customizer/customizer-footer-callout.php');
  30. require( WEBRITI_THEME_FUNCTIONS_PATH . '/customizer/customizer-template.php');
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37. // Custom Category control
  38. require( WEBRITI_THEME_FUNCTIONS_PATH . '/custom-controls/select/category-dropdown-custom-control.php');
  39. /* Theme Setup Function */
  40. add_action( 'after_setup_theme', 'appointment_setup' );
  41.  
  42. function appointment_setup()
  43. {
  44. // Load text domain for translation-ready
  45. load_theme_textdomain( 'appointment', WEBRITI_THEME_FUNCTIONS_PATH . '/lang' );
  46.  
  47. $header_args = array(
  48. 'flex-height' => true,
  49. 'height' => 200,
  50. 'flex-width' => true,
  51. 'width' => 1600,
  52. 'admin-head-callback' => 'mytheme_admin_header_style',
  53. );
  54.  
  55. add_theme_support( 'custom-header', $header_args );
  56. add_theme_support( 'post-thumbnails' ); //supports featured image
  57. // Register primary menu
  58. register_nav_menu( 'primary', __( 'Primary Menu', 'appointment' ) );
  59. // Add default posts and comments RSS feed links to head.
  60. add_theme_support( 'automatic-feed-links' );
  61. // Set the content_width with 900
  62. if ( ! isset( $content_width ) ) $content_width = 900;
  63. require_once('theme_setup_data.php');
  64. }
  65. // set appoinment page title
  66. function appointment_title( $title, $sep )
  67. {
  68. global $paged, $page;
  69.  
  70. if ( is_feed() )
  71. return $title;
  72. // Add the site name.
  73. $title .= get_bloginfo( 'name' );
  74. // Add the site description for the home/front page.
  75. $site_description = get_bloginfo( 'description' );
  76. if ( $site_description && ( is_home() || is_front_page() ) )
  77. $title = "$title $sep $site_description";
  78. // Add a page number if necessary.
  79. if ( $paged >= 2 || $page >= 2 )
  80. $title = "$title $sep " . sprintf( __( 'Page', 'appointment' ), max( $paged, $page ) );
  81. return $title;
  82. }
  83. add_filter( 'wp_title', 'appointment_title', 10,2 );
  84.  
  85. add_filter('get_avatar','appointment_add_gravatar_class');
  86. add_theme_support( "title-tag" );
  87.  
  88. function appointment_add_gravatar_class($class) {
  89. $class = str_replace("class='avatar", "class='img-responsive img-circle", $class);
  90. return $class;
  91. }
  92. function appointment_add_to_author_profile( $contactmethods ) {
  93. $contactmethods['facebook_profile'] = __('Facebook Profile URL','appointment');
  94. $contactmethods['twitter_profile'] = __('Twitter Profile URL','appointment');
  95. $contactmethods['linkedin_profile'] = __('Linkedin Profile URL','appointment');
  96. $contactmethods['google_profile'] = __('Google Profile URL','appointment');
  97. return $contactmethods;
  98. }
  99. add_filter( 'user_contactmethods', 'appointment_add_to_author_profile', 10, 1);
  100.  
  101. function appointment_excerpt_length($length ) {
  102. return 25;
  103. }
  104. add_filter( 'excerpt_length', 'appointment_excerpt_length', 999 );
  105.  
  106. add_filter('get_the_excerpt','appointment_post_slider_excerpt');
  107. add_filter('excerpt_more','__return_false');
  108. function appointment_post_slider_excerpt($output){
  109. $output = strip_tags(preg_replace(" (\[.*?\])",'',$output));
  110. $output = strip_shortcodes($output);
  111. $original_len = strlen($output);
  112. $output = substr($output, 0, 170);
  113. $len=strlen($output);
  114. if($original_len>170) {
  115. $output = $output;
  116. return '<div class="slide-text-bg2">' .'<span>'.$output.'</span>'.'</div>'.
  117. '<div class="blog-btn-area-sm"><a href="' . get_permalink() . '" class="blog-btn-sm">'.__("
  118. Read more","appointment").'</a></div>';
  119. }
  120. else
  121. { return '<div class="slide-text-bg2">' .'<span>'.$output.'</span>'.'</div>'; }
  122. }
  123.  
  124. function get_home_blog_excerpt()
  125. {
  126. global $post;
  127. $excerpt = get_the_content();
  128. $excerpt = strip_tags(preg_replace(" (\[.*?\])",'',$excerpt));
  129. $excerpt = strip_shortcodes($excerpt);
  130. $original_len = strlen($excerpt);
  131. $excerpt = substr($excerpt, 0, 145);
  132. $len=strlen($excerpt);
  133. if($original_len>275) {
  134. $excerpt = $excerpt;
  135. return $excerpt . '<div class="blog-btn-area-sm"><a href="' . get_permalink() . '" class="blog-btn-sm">Read More</a></div>';
  136. }
  137. else
  138. { return $excerpt; }
  139. }
  140.  
  141. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement