Advertisement
Guest User

Untitled

a guest
Jan 6th, 2014
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.13 KB | None | 0 0
  1. <?php
  2. //* Start the engine
  3. require_once( get_template_directory() . '/lib/init.php' );
  4.  
  5. //* Child theme (do not remove)
  6. define( 'CHILD_THEME_NAME', 'Ally Theme', 'ally' );
  7. define( 'CHILD_THEME_URL', 'http://appfinite.com/themes/ally' );
  8.  
  9. //* Enqueue Lato Google font
  10. add_action( 'wp_enqueue_scripts', 'genesis_sample_google_fonts' );
  11. function genesis_sample_google_fonts() {
  12. wp_enqueue_style( 'google-font', '//fonts.googleapis.com/css?family=Open+Sans:700,600,400,300', array(), PARENT_THEME_VERSION );
  13. }
  14.  
  15. add_action( 'wp_enqueue_scripts', 'prefix_enqueue_awesome' );
  16. /**
  17. * Register and load font awesome
  18. * CSS files using a CDN.
  19. *
  20. * @link http://www.bootstrapcdn.com/#tab_fontawesome
  21. *
  22. */
  23. function prefix_enqueue_awesome() {
  24. wp_enqueue_style( 'prefix-font-awesome', '//netdna.bootstrapcdn.com/font-awesome/3.2.0/css/font-awesome.min.css', array(), '3.2.0' );
  25. }
  26.  
  27. //* Add HTML5 markup structure
  28. add_theme_support( 'html5' );
  29.  
  30. //* Add viewport meta tag for mobile browsers
  31. add_theme_support( 'genesis-responsive-viewport' );
  32.  
  33. //* Add support for custom background
  34. add_theme_support( 'custom-background' );
  35.  
  36. // Create additional color style options
  37. add_theme_support( 'genesis-style-selector', array(
  38. 'ally-light' => __( 'Light', 'ally' ),
  39. 'ally-dark' => __( 'Dark', 'ally' ),
  40. 'ally-blue' => __( 'Blue', 'ally' ),
  41. 'ally-green' => __( 'Green', 'ally' ),
  42. 'ally-lightblue' => __( 'Light Blue', 'ally' ),
  43. 'ally-orange' => __( 'Orange', 'ally' ),
  44. 'ally-pink' => __( 'Pink', 'ally' ),
  45. 'ally-purple' => __( 'Purple', 'ally' ),
  46. 'ally-red' => __( 'Red', 'ally' ),
  47. ) );
  48.  
  49. // Add support for custom header
  50. add_theme_support( 'genesis-custom-header', array(
  51. 'width' => 320,
  52. 'height' => 80
  53. ) );
  54.  
  55. // Add new image sizes
  56. add_image_size( 'featured-img', 640, 420, TRUE );
  57. add_image_size( 'featured-page', 312, 173, TRUE );
  58. add_image_size( 'portfolio-thumbnail', 264, 200, TRUE );
  59.  
  60. // Add support for structural wraps
  61. add_theme_support( 'genesis-structural-wraps', array( 'header', 'nav', 'subnav', 'inner', 'footer-widgets', 'footer' ) );
  62.  
  63. // Reposition the Secondary Navigation
  64. remove_action( 'genesis_after_header', 'genesis_do_subnav' ) ;
  65. add_action( 'genesis_before_header', 'genesis_do_subnav' );
  66.  
  67. // Before Header Wrap
  68. add_action( 'genesis_before_header', 'before_header_wrap' );
  69. function before_header_wrap() {
  70. echo '<div class="head-wrap">';
  71. }
  72.  
  73. // After Header Wrap
  74. add_action( 'genesis_after_header', 'after_header_wrap' );
  75. function after_header_wrap() {
  76. echo '</div>';
  77. }
  78.  
  79. // Reposition the Primary Navigation
  80. remove_action( 'genesis_after_header', 'genesis_do_nav' ) ;
  81. add_action( 'genesis_after_header', 'genesis_do_nav', 2 );
  82.  
  83. // Customize search form input box text
  84. add_filter( 'genesis_search_text', 'custom_search_text' );
  85. function custom_search_text($text) {
  86. return esc_attr( 'Search...' );
  87. }
  88.  
  89. add_action( 'admin_menu', 'ally_theme_settings_init', 15 );
  90. /**
  91. * This is a necessary go-between to get our scripts and boxes loaded
  92. * on the theme settings page only, and not the rest of the admin
  93. */
  94. function ally_theme_settings_init() {
  95. global $_genesis_admin_settings;
  96.  
  97. add_action( 'load-' . $_genesis_admin_settings->pagehook, 'ally_add_portfolio_settings_box', 20 );
  98. }
  99.  
  100. // Add Portfolio Settings box to Genesis Theme Settings
  101. function ally_add_portfolio_settings_box() {
  102. global $_genesis_admin_settings;
  103.  
  104. add_meta_box( 'genesis-theme-settings-ally-portfolio', __( 'Portfolio Page Settings', 'ally' ), 'ally_theme_settings_portfolio', $_genesis_admin_settings->pagehook, 'main' );
  105. }
  106.  
  107. /**
  108. * Adds Portfolio Options to Genesis Theme Settings Page
  109. */
  110. function ally_theme_settings_portfolio() { ?>
  111.  
  112. <p><?php _e("Display which category:", 'genesis'); ?>
  113. <?php wp_dropdown_categories(array('selected' => genesis_get_option('ally_portfolio_cat'), 'name' => GENESIS_SETTINGS_FIELD.'[ally_portfolio_cat]', 'orderby' => 'Name' , 'hierarchical' => 1, 'show_option_all' => __("All Categories", 'genesis'), 'hide_empty' => '0' )); ?></p>
  114.  
  115. <p><?php _e("Exclude the following Category IDs:", 'genesis'); ?><br />
  116. <input type="text" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[ally_portfolio_cat_exclude]" value="<?php echo esc_attr( genesis_get_option('ally_portfolio_cat_exclude') ); ?>" size="40" /><br />
  117. <small><strong><?php _e("Comma separated - 1,2,3 for example", 'genesis'); ?></strong></small></p>
  118.  
  119. <p><?php _e('Number of Posts to Show', 'genesis'); ?>:
  120. <input type="text" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[ally_portfolio_cat_num]" value="<?php echo esc_attr( genesis_option('ally_portfolio_cat_num') ); ?>" size="2" /></p>
  121.  
  122. <p><span class="description"><?php _e('<b>NOTE:</b> The Portfolio Page displays the "Portfolio Page" image size plus the excerpt or full content as selected below.', 'ally'); ?></span></p>
  123.  
  124. <p><?php _e("Select one of the following:", 'genesis'); ?>
  125. <select name="<?php echo GENESIS_SETTINGS_FIELD; ?>[ally_portfolio_content]">
  126. <option style="padding-right:10px;" value="full" <?php selected('full', genesis_get_option('ally_portfolio_content')); ?>><?php _e("Display post content", 'genesis'); ?></option>
  127. <option style="padding-right:10px;" value="excerpts" <?php selected('excerpts', genesis_get_option('ally_portfolio_content')); ?>><?php _e("Display post excerpts", 'genesis'); ?></option>
  128. </select></p>
  129.  
  130. <p><label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[ally_portfolio_content_archive_limit]"><?php _e('Limit content to', 'genesis'); ?></label> <input type="text" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[ally_portfolio_content_archive_limit]" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[ally_portfolio_content_archive_limit]" value="<?php echo esc_attr( genesis_option('ally_portfolio_content_archive_limit') ); ?>" size="3" /> <label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[ally_portfolio_content_archive_limit]"><?php _e('characters', 'genesis'); ?></label></p>
  131.  
  132. <p><span class="description"><?php _e('<b>NOTE:</b> Using this option will limit the text and strip all formatting from the text displayed. To use this option, choose "Display post content" in the select box above.', 'genesis'); ?></span></p>
  133. <?php
  134. }
  135.  
  136. //* Add support for 3-column footer widgets
  137. add_theme_support( 'genesis-footer-widgets', 3 );
  138.  
  139. /** Register widget areas */
  140. genesis_register_sidebar( array(
  141. 'id' => 'slider-wide',
  142. 'name' => __( 'Slider Wide', 'ally' ),
  143. 'description' => __( 'This is the wide full width slider section of the homepage.', 'ally' ),
  144. ) );
  145. genesis_register_sidebar( array(
  146. 'id' => 'slider',
  147. 'name' => __( 'Slider', 'ally' ),
  148. 'description' => __( 'This is the slider section of the homepage.', 'ally' ),
  149. ) );
  150. genesis_register_sidebar( array(
  151. 'id' => 'welcome',
  152. 'name' => __( 'Welcome', 'ally' ),
  153. 'description' => __( 'This is the welcome section of the homepage.', 'ally' ),
  154. ) );
  155. genesis_register_sidebar( array(
  156. 'id' => 'home-feature-1',
  157. 'name' => __( 'Home Feature#1', 'ally' ),
  158. 'description' => __( 'This is the first column of the feature section of the homepage.', 'ally' ),
  159. ) );
  160. genesis_register_sidebar( array(
  161. 'id' => 'home-feature-2',
  162. 'name' => __( 'Home Feature#2', 'ally' ),
  163. 'description' => __( 'This is the second column of the feature section of the homepage.', 'ally' ),
  164. ) );
  165. genesis_register_sidebar( array(
  166. 'id' => 'home-feature-3',
  167. 'name' => __( 'Home Feature#3', 'ally' ),
  168. 'description' => __( 'This is the 3rd column of the feature section of the homepage.', 'ally' ),
  169. ) );
  170. genesis_register_sidebar( array(
  171. 'id' => 'home-middle-wide',
  172. 'name' => __( 'Home Middle Wide', 'ally' ),
  173. 'description' => __( 'This is the middle wide section of the homepage.', 'ally' ),
  174. ) );
  175. genesis_register_sidebar( array(
  176. 'id' => 'home-middle-1',
  177. 'name' => __( 'Home Middle 1', 'ally' ),
  178. 'description' => __( 'This is the first sidebar of the middle section of the homepage.', 'ally' ),
  179. ) );
  180. genesis_register_sidebar( array(
  181. 'id' => 'home-middle-2',
  182. 'name' => __( 'Home Middle 2', 'ally' ),
  183. 'description' => __( 'This is the second sidebar of the middle section of the homepage.', 'ally' ),
  184. ) );
  185. genesis_register_sidebar( array(
  186. 'id' => 'home-middle-3-wide',
  187. 'name' => __( 'Home Middle 3 Wide', 'ally' ),
  188. 'description' => __( 'This is the wide middle section of the homepage.', 'ally' ),
  189. ) );
  190. genesis_register_sidebar( array(
  191. 'id' => 'home-middle-4',
  192. 'name' => __( 'Home Middle 4', 'ally' ),
  193. 'description' => __( 'This is the fourth sidebar of the middle section of the homepage.', 'ally' ),
  194. ) );
  195. genesis_register_sidebar( array(
  196. 'id' => 'home-middle-5',
  197. 'name' => __( 'Home Middle 5', 'ally' ),
  198. 'description' => __( 'This is the fifth sidebar of the middle feature section of the homepage.', 'ally' ),
  199. ) );
  200. genesis_register_sidebar( array(
  201. 'id' => 'home-bottom-1',
  202. 'name' => __( 'Home Bottom 1', 'ally' ),
  203. 'description' => __( 'This is the first sidebar of the bottom section of the homepage.', 'ally' ),
  204. ) );
  205. genesis_register_sidebar( array(
  206. 'id' => 'home-bottom-2',
  207. 'name' => __( 'Home Bottom 2', 'ally' ),
  208. 'description' => __( 'This is the second sidebar of the bottom section of the homepage.', 'ally' ),
  209. ) );
  210. genesis_register_sidebar( array(
  211. 'id' => 'home-bottom-3',
  212. 'name' => __( 'Home Bottom 3', 'ally' ),
  213. 'description' => __( 'This is the third sidebar of the bottom section of the homepage.', 'ally' ),
  214. ) );
  215. genesis_register_sidebar( array(
  216. 'id' => 'home-bottom-4',
  217. 'name' => __( 'Home Bottom 4', 'ally' ),
  218. 'description' => __( 'This is the fourth sidebar of the bottom section of the homepage.', 'ally' ),
  219. ) );
  220. genesis_register_sidebar( array(
  221. 'id' => 'home-bottom-wide',
  222. 'name' => __( 'Home Bottom Wide', 'ally' ),
  223. 'description' => __( 'This is the very bottom section of the homepage.', 'ally' ),
  224. ) );
  225.  
  226. //* Display author box on single posts
  227. add_filter( 'get_the_author_genesis_author_box_single', '__return_true' );
  228.  
  229. //* Modify the size of the Gravatar in the author box
  230. add_filter( 'genesis_author_box_gravatar_size', 'author_box_gravatar_size' );
  231. function author_box_gravatar_size( $size ) {
  232. return '120';
  233. }
  234.  
  235. //* Register newsletter widget area
  236. genesis_register_sidebar( array(
  237. 'id' => 'newsletter',
  238. 'name' => __( 'Newsletter', 'custom-theme' ),
  239. 'description' => __( 'This is the newsletter section.', 'custom-theme' ),
  240. ) );
  241.  
  242. //* Add the newsletter widget after the post content
  243. add_action( 'genesis_entry_footer', 'custom_add_newsletter_box' );
  244. function custom_add_newsletter_box() {
  245. if ( is_singular( 'post' ) )
  246. genesis_widget_area( 'newsletter', array(
  247. 'before' => '<div id="newsletter">',
  248. ) );
  249. }
  250.  
  251. //* Add Jetpack share buttons above post
  252. remove_filter( 'the_content', 'sharing_display', 19 );
  253. remove_filter( 'the_excerpt', 'sharing_display', 19 );
  254.  
  255. add_filter( 'the_content', 'sp_share_buttons_above_post', 19 );
  256. add_filter( 'the_excerpt', 'sp_share_buttons_above_post', 19 );
  257.  
  258. function sp_share_buttons_above_post( $content = '' ) {
  259. if ( function_exists( 'sharing_display' ) ) {
  260. return sharing_display() . $content;
  261. }
  262. else {
  263. return $content;
  264. }
  265. }
  266.  
  267. remove_action( 'genesis_after_post_content', 'genesis_post_meta' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement