Advertisement
Marijn817

MyFunctions.php

Aug 15th, 2014
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.73 KB | None | 0 0
  1. <?php
  2. //* Start the engine
  3. include_once( get_template_directory() . '/lib/init.php' );
  4.  
  5. //* Set Localization (do not remove)
  6. load_child_theme_textdomain( 'agency', apply_filters( 'child_theme_textdomain', get_stylesheet_directory() . '/languages', 'parallax' ) );
  7.  
  8. //* Add Image upload to WordPress Theme Customizer
  9. add_action( 'customize_register', 'parallax_customizer' );
  10. function parallax_customizer(){
  11.  
  12. require_once( get_stylesheet_directory() . '/lib/customize.php' );
  13.  
  14. }
  15.  
  16. //* Include Section Image CSS
  17. include_once( get_stylesheet_directory() . '/lib/output.php' );
  18.  
  19. //* Child theme (do not remove)
  20. define( 'CHILD_THEME_NAME', 'Parallax Pro Theme' );
  21. define( 'CHILD_THEME_URL', 'http://my.studiopress.com/themes/parallax/' );
  22. define( 'CHILD_THEME_VERSION', '1.0' );
  23.  
  24. //* Enqueue scripts and styles
  25. add_action( 'wp_enqueue_scripts', 'parallax_enqueue_scripts_styles' );
  26. function parallax_enqueue_scripts_styles() {
  27.  
  28. wp_enqueue_script( 'parallax-responsive-menu', get_bloginfo( 'stylesheet_directory' ) . '/js/responsive-menu.js', array( 'jquery' ), '1.0.0' );
  29. wp_enqueue_style( 'dashicons' );
  30. wp_enqueue_style( 'parallax-google-fonts', '//fonts.googleapis.com/css?family=Montserrat|Sorts+Mill+Goudy', array(), CHILD_THEME_VERSION );
  31.  
  32. }
  33.  
  34. //* Add HTML5 markup structure
  35. add_theme_support( 'html5' );
  36.  
  37. //* Add viewport meta tag for mobile browsers
  38. add_theme_support( 'genesis-responsive-viewport' );
  39.  
  40. //* Add support for 3-column footer widgets
  41. add_theme_support( 'genesis-footer-widgets', 1 );
  42.  
  43. //* Reposition the primary navigation menu
  44. remove_action( 'genesis_after_header', 'genesis_do_nav' );
  45. add_action( 'genesis_before_content_sidebar_wrap', 'genesis_do_nav' );
  46.  
  47. //* Reposition the secondary navigation menu
  48. remove_action( 'genesis_after_header', 'genesis_do_subnav' );
  49. add_action( 'genesis_footer', 'genesis_do_subnav', 7 );
  50.  
  51. //* Reduce the secondary navigation menu to one level depth
  52. add_filter( 'wp_nav_menu_args', 'parallax_secondary_menu_args' );
  53. function parallax_secondary_menu_args( $args ){
  54.  
  55. if( 'secondary' != $args['theme_location'] )
  56. return $args;
  57.  
  58. $args['depth'] = 1;
  59. return $args;
  60.  
  61. }
  62.  
  63. //* Unregister layout settings
  64. genesis_unregister_layout( 'content-sidebar-sidebar' );
  65. genesis_unregister_layout( 'sidebar-content-sidebar' );
  66. genesis_unregister_layout( 'sidebar-sidebar-content' );
  67.  
  68. //* Add support for additional color styles
  69. add_theme_support( 'genesis-style-selector', array(
  70. 'parallax-pro-blue' => __( 'Parallax Pro Blue', 'parallax' ),
  71. 'parallax-pro-green' => __( 'Parallax Pro Green', 'parallax' ),
  72. 'parallax-pro-orange' => __( 'Parallax Pro Orange', 'parallax' ),
  73. 'parallax-pro-pink' => __( 'Parallax Pro Pink', 'parallax' ),
  74. ) );
  75.  
  76. //* Unregister secondary sidebar
  77. unregister_sidebar( 'sidebar-alt' );
  78.  
  79. //* Add support for custom header
  80. add_theme_support( 'custom-header', array(
  81. 'width' => 360,
  82. 'height' => 70,
  83. 'header-selector' => '.site-title a',
  84. 'header-text' => false,
  85. ) );
  86.  
  87. //* Add support for structural wraps
  88. add_theme_support( 'genesis-structural-wraps', array(
  89. 'header',
  90. 'nav',
  91. 'subnav',
  92. 'footer-widgets',
  93. 'footer',
  94. ) );
  95.  
  96. //* Hook after post widget after the entry content
  97. add_action( 'genesis_after_entry', 'parallax_after_entry', 5 );
  98. function parallax_after_entry() {
  99.  
  100. if ( is_singular( 'post' ) )
  101. genesis_widget_area( 'after-entry', array(
  102. 'before' => '<div class="after-entry widget-area">',
  103. 'after' => '</div>',
  104. ) );
  105.  
  106. }
  107.  
  108. //* Modify the size of the Gravatar in the author box
  109. add_filter( 'genesis_author_box_gravatar_size', 'parallax_author_box_gravatar' );
  110. function parallax_author_box_gravatar( $size ) {
  111.  
  112. return 176;
  113.  
  114. }
  115.  
  116. //* Modify the size of the Gravatar in the entry comments
  117. add_filter( 'genesis_comment_list_args', 'parallax_comments_gravatar' );
  118. function parallax_comments_gravatar( $args ) {
  119.  
  120. $args['avatar_size'] = 120;
  121.  
  122. return $args;
  123.  
  124. }
  125.  
  126. //* Register widget areas
  127. genesis_register_sidebar( array(
  128. 'id' => 'home-section-1',
  129. 'name' => __( 'Home Section 1', 'parallax' ),
  130. 'description' => __( 'This is the home section 1 section.', 'parallax' ),
  131. ) );
  132. genesis_register_sidebar( array(
  133. 'id' => 'home-section-2',
  134. 'name' => __( 'Home Section 2', 'parallax' ),
  135. 'description' => __( 'This is the home section 2 section.', 'parallax' ),
  136. ) );
  137. genesis_register_sidebar( array(
  138. 'id' => 'home-section-3',
  139. 'name' => __( 'Home Section 3', 'parallax' ),
  140. 'description' => __( 'This is the home section 3 section.', 'parallax' ),
  141. ) );
  142. genesis_register_sidebar( array(
  143. 'id' => 'home-section-4',
  144. 'name' => __( 'Home Section 4', 'parallax' ),
  145. 'description' => __( 'This is the home section 4 section.', 'parallax' ),
  146. ) );
  147. genesis_register_sidebar( array(
  148. 'id' => 'home-section-5',
  149. 'name' => __( 'Home Section 5', 'parallax' ),
  150. 'description' => __( 'This is the home section 5 section.', 'parallax' ),
  151. ) );
  152. genesis_register_sidebar( array(
  153. 'id' => 'after-entry',
  154. 'name' => __( 'After Entry', 'parallax' ),
  155. 'description' => __( 'This is the after entry widget area.', 'parallax' ),
  156. ) );
  157.  
  158. // ZELF TOEGEVOEGD
  159.  
  160. add_theme_support( 'genesis-connect-woocommerce' );
  161.  
  162. add_filter( 'add_to_cart_text', 'woo_custom_cart_button_text' ); // < 2.1
  163. add_filter( 'woocommerce_product_add_to_cart_text', 'woo_custom_cart_button_text' ); // 2.1 +
  164. function woo_custom_cart_button_text() {
  165. return __( 'Nu Shoppen', 'woocommerce' );
  166. }
  167.  
  168. add_filter( 'get_the_author_genesis_author_box_single', '__return_false' );
  169.  
  170. // Display 24 products per page.
  171. add_filter( 'loop_shop_per_page', create_function( '$cols', 'return 24;' ), 20 );
  172.  
  173. //* Modify the Genesis content limit read more link
  174. add_filter( 'get_the_content_more_link', 'sp_read_more_link' );
  175. function sp_read_more_link() {
  176. return '... <a class="more-link" href="' . get_permalink() . '">>>VERDER LEZEN</a>';
  177. }
  178.  
  179. //* Add new featured image sizes
  180. add_image_size( 'blogposts', 900, 450, TRUE );
  181. add_image_size( 'blogposts2', 800, 300, TRUE );
  182.  
  183. function be_home_layout( $layout ) {
  184. if( is_home() || is_archive() || is_single() )
  185. $layout = 'content-sidebar';
  186. return $layout;
  187. }
  188. add_filter( 'genesis_pre_get_option_site_layout', 'be_home_layout' );
  189.  
  190. add_filter('post_class', 'grid_view_post_class');
  191. function grid_view_post_class( $classes ) {
  192. if( is_category('38')):
  193. $classes[] = 'one-third';
  194. global $wp_query;
  195. if( 0 == $wp_query->current_post || 0 == $wp_query->current_post % $columns )
  196. $classes[] = 'first';
  197. endif;
  198. return $classes;
  199. }
  200. add_action('pre_get_posts', 'post_items');
  201. function post_items( $query ) {
  202. if( $query->is_main_query() && !is_admin() && is_category('38') ) {
  203. $query->set( 'posts_per_page', '9' );
  204. }
  205. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement