equinoccimanu

equinocci web theme's function

Aug 7th, 2013
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.93 KB | None | 0 0
  1. <?php
  2. /**
  3. * Attitude Pro defining constants, adding files and WordPress core functionality.
  4. *
  5. * Defining some constants, loading all the required files and Adding some core functionality.
  6. * @uses add_theme_support() To add support for post thumbnails and automatic feed links.
  7. * @uses register_nav_menu() To add support for navigation menu.
  8. * @uses set_post_thumbnail_size() To set a custom post thumbnail size.
  9. *
  10. * @package Theme Horse
  11. * @subpackage Attitude Pro
  12. * @since Attitude Pro 1.0
  13. */
  14.  
  15. /**
  16. * Set the content width based on the theme's design and stylesheet.
  17. */
  18. if ( ! isset( $content_width ) )
  19. $content_width = 700;
  20.  
  21. add_action( 'attitude_init', 'attitude_constants', 10 );
  22. /**
  23. * This function defines the Attitude Pro theme constants
  24. *
  25. * @since 1.0
  26. */
  27. function attitude_constants() {
  28.  
  29. /** Define Directory Location Constants */
  30. define( 'ATTITUDE_PARENT_DIR', get_template_directory() );
  31. define( 'ATTITUDE_CHILD_DIR', get_stylesheet_directory() );
  32. define( 'ATTITUDE_IMAGES_DIR', ATTITUDE_PARENT_DIR . '/images' );
  33. define( 'ATTITUDE_LIBRARY_DIR', ATTITUDE_PARENT_DIR. '/library' );
  34. define( 'ATTITUDE_ADMIN_DIR', ATTITUDE_LIBRARY_DIR . '/admin' );
  35. define( 'ATTITUDE_ADMIN_IMAGES_DIR', ATTITUDE_ADMIN_DIR . '/images' );
  36. define( 'ATTITUDE_ADMIN_JS_DIR', ATTITUDE_ADMIN_DIR . '/js' );
  37. define( 'ATTITUDE_ADMIN_CSS_DIR', ATTITUDE_ADMIN_DIR . '/css' );
  38. define( 'ATTITUDE_JS_DIR', ATTITUDE_LIBRARY_DIR . '/js' );
  39. define( 'ATTITUDE_CSS_DIR', ATTITUDE_LIBRARY_DIR . '/css' );
  40. define( 'ATTITUDE_PLUGINS_DIR', ATTITUDE_LIBRARY_DIR . '/plugins' );
  41. define( 'ATTITUDE_FUNCTIONS_DIR', ATTITUDE_LIBRARY_DIR . '/functions' );
  42. define( 'ATTITUDE_SHORTCODES_DIR', ATTITUDE_LIBRARY_DIR . '/shortcodes' );
  43. define( 'ATTITUDE_STRUCTURE_DIR', ATTITUDE_LIBRARY_DIR . '/structure' );
  44. if ( ! defined( 'ATTITUDE_LANGUAGES_DIR' ) ) /** So we can define with a child theme */
  45. define( 'ATTITUDE_LANGUAGES_DIR', ATTITUDE_LIBRARY_DIR . '/languages' );
  46. define( 'ATTITUDE_WIDGETS_DIR', ATTITUDE_LIBRARY_DIR . '/widgets' );
  47.  
  48. /** Define URL Location Constants */
  49. define( 'ATTITUDE_PARENT_URL', get_template_directory_uri() );
  50. define( 'ATTITUDE_CHILD_URL', get_stylesheet_directory_uri() );
  51. define( 'ATTITUDE_IMAGES_URL', ATTITUDE_PARENT_URL . '/images' );
  52. define( 'ATTITUDE_LIBRARY_URL', ATTITUDE_PARENT_URL . '/library' );
  53. define( 'ATTITUDE_ADMIN_URL', ATTITUDE_LIBRARY_URL . '/admin' );
  54. define( 'ATTITUDE_ADMIN_IMAGES_URL', ATTITUDE_ADMIN_URL . '/images' );
  55. define( 'ATTITUDE_ADMIN_JS_URL', ATTITUDE_ADMIN_URL . '/js' );
  56. define( 'ATTITUDE_ADMIN_CSS_URL', ATTITUDE_ADMIN_URL . '/css' );
  57. define( 'ATTITUDE_JS_URL', ATTITUDE_LIBRARY_URL . '/js' );
  58. define( 'ATTITUDE_CSS_URL', ATTITUDE_LIBRARY_URL . '/css' );
  59. define( 'ATTITUDE_PLUGINS_URL', ATTITUDE_LIBRARY_URL . '/plugins' );
  60. define( 'ATTITUDE_FUNCTIONS_URL', ATTITUDE_LIBRARY_URL . '/functions' );
  61. define( 'ATTITUDE_SHORTCODES_URL', ATTITUDE_LIBRARY_URL . '/shortcodes' );
  62. define( 'ATTITUDE_STRUCTURE_URL', ATTITUDE_LIBRARY_URL . '/structure' );
  63. if ( ! defined( 'ATTITUDE_LANGUAGES_URL' ) ) /** So we can predefine to child theme */
  64. define( 'ATTITUDE_LANGUAGES_URL', ATTITUDE_LIBRARY_URL . '/languages' );
  65. define( 'ATTITUDE_WIDGETS_URL', ATTITUDE_LIBRARY_URL . '/widgets' );
  66.  
  67. }
  68.  
  69. add_action( 'attitude_init', 'attitude_load_files', 15 );
  70. /**
  71. * Loading the included files.
  72. *
  73. * @since 1.0
  74. */
  75. function attitude_load_files() {
  76. /**
  77. * attitude_add_files hook
  78. *
  79. * Adding other addtional files if needed.
  80. */
  81. do_action( 'attitude_add_files' );
  82.  
  83. /** Load functions */
  84. require_once( ATTITUDE_FUNCTIONS_DIR . '/i18n.php' );
  85. require_once( ATTITUDE_FUNCTIONS_DIR . '/custom-header.php' );
  86. require_once( ATTITUDE_FUNCTIONS_DIR . '/functions.php' );
  87. require_once( ATTITUDE_FUNCTIONS_DIR . '/custom-style.php' );
  88.  
  89. require_once( ATTITUDE_ADMIN_DIR . '/attitude-themeoptions-defaults.php' );
  90. require_once( ATTITUDE_ADMIN_DIR . '/theme-options.php' );
  91. require_once( ATTITUDE_ADMIN_DIR . '/attitude-metaboxes.php' );
  92. require_once( ATTITUDE_ADMIN_DIR . '/attitude-custom-post-types.php' );
  93. require_once( ATTITUDE_ADMIN_DIR . '/attitude-show-post-id.php' );
  94.  
  95. /** Load Shortcodes */
  96. require_once( ATTITUDE_SHORTCODES_DIR . '/attitude-shortcodes.php' );
  97.  
  98. /** Load Structure */
  99. require_once( ATTITUDE_STRUCTURE_DIR . '/header-extensions.php' );
  100. require_once( ATTITUDE_STRUCTURE_DIR . '/searchform-extensions.php' );
  101. require_once( ATTITUDE_STRUCTURE_DIR . '/sidebar-extensions.php' );
  102. require_once( ATTITUDE_STRUCTURE_DIR . '/footer-extensions.php' );
  103. require_once( ATTITUDE_STRUCTURE_DIR . '/content-extensions.php' );
  104.  
  105. /** Load Widgets and Widgetized Area */
  106. require_once( ATTITUDE_WIDGETS_DIR . '/attitude_widgets.php' );
  107.  
  108. /** Fuction to help install the plugin from within the theme */
  109. require_once( ATTITUDE_FUNCTIONS_DIR . '/class-tgm-plugin-activation.php' );
  110. require_once( ATTITUDE_FUNCTIONS_DIR . '/activate-plugin.php' );
  111. //require_once( ATTITUDE_FUNCTIONS_DIR . '/sidebar_generator.php' );
  112.  
  113. /** Load update notifier */
  114. require_once( ATTITUDE_FUNCTIONS_DIR . '/update_notifier.php' );
  115. }
  116.  
  117. add_action( 'attitude_init', 'attitude_core_functionality', 20 );
  118. /**
  119. * Adding the core functionality of WordPess.
  120. *
  121. * @since 1.0
  122. */
  123. function attitude_core_functionality() {
  124. global $attitude_theme_options_settings;
  125. $options = $attitude_theme_options_settings;
  126. /**
  127. * attitude_add_functionality hook
  128. *
  129. * Adding other addtional functionality if needed.
  130. */
  131. do_action( 'attitude_add_functionality' );
  132.  
  133. // Add default posts and comments RSS feed links to head
  134. add_theme_support( 'automatic-feed-links' );
  135.  
  136. // This theme uses Featured Images (also known as post thumbnails) for per-post/per-page.
  137. add_theme_support( 'post-thumbnails' );
  138.  
  139. // Remove WordPress version from header for security concern
  140. remove_action( 'wp_head', 'wp_generator' );
  141.  
  142. // This theme uses wp_nav_menu() in header menu location.
  143. register_nav_menu( 'primary', __( 'Primary Menu', 'attitude' ) );
  144.  
  145. // Add Attitude Pro custom image sizes
  146. add_image_size( 'featured', 670, 300, true );
  147. add_image_size( 'featured-medium', 230, 230, true );
  148. add_image_size( 'slider-narrow', 1038, 460, true ); // used on Featured Slider on Homepage Header for narrow layout
  149. add_image_size( 'slider-wide', 1400, 460, true ); // used on Featured Slider on Homepage Header for wide layout
  150. add_image_size( 'gallery', 474, 342, true ); // used to show gallery all images
  151. add_image_size( 'icon', 80, 80, true ); //used for icon on business layout
  152.  
  153. if( $options['site_layout'] == 'narrow-layout') {
  154. /**
  155. * This theme supports custom background color and image
  156. */
  157. add_theme_support( 'custom-background' );
  158. }
  159.  
  160. // Adding excerpt option box for pages as well
  161. add_post_type_support( 'page', 'excerpt' );
  162. }
  163.  
  164. /**
  165. * attitude_init hook
  166. *
  167. * Hooking some functions of functions.php file to this action hook.
  168. */
  169. do_action( 'attitude_init' );
  170. ?>
Advertisement
Add Comment
Please, Sign In to add comment