Advertisement
Guest User

Untitled

a guest
May 20th, 2018
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.71 KB | None | 0 0
  1. <?php
  2.  
  3. // Include Beans
  4. require_once( get_template_directory() . '/lib/init.php' );
  5.  
  6.  
  7. // Remove Beans default styling
  8. remove_theme_support( 'beans-default-styling' );
  9.  
  10.  
  11. // Enqueue uikit assets
  12. beans_add_smart_action( 'beans_uikit_enqueue_scripts', 'banks_enqueue_uikit_assets', 5 );
  13.  
  14. function banks_enqueue_uikit_assets() {
  15.  
  16. // Enqueue uikit overwrite theme folder
  17. beans_uikit_enqueue_theme( 'banks', get_stylesheet_directory_uri() . '/assets/less/uikit' );
  18.  
  19. // Add the theme style as a uikit fragment to have access to all the variables
  20. beans_compiler_add_fragment( 'uikit', get_stylesheet_directory_uri() . '/assets/less/style.less', 'less' );
  21.  
  22. // Add the theme js as a uikit fragment
  23. beans_compiler_add_fragment( 'uikit', get_stylesheet_directory_uri() . '/assets/js/banks.js', 'js' );
  24.  
  25. // Include the uikit components needed
  26. beans_uikit_enqueue_components( array( 'contrast' ) );
  27.  
  28. }
  29.  
  30.  
  31. // Register bottom widget area
  32. beans_add_smart_action( 'widgets_init', 'banks_register_bottom_widget_area' );
  33.  
  34. function banks_register_bottom_widget_area() {
  35.  
  36. beans_register_widget_area( array(
  37. 'name' => 'Bottom',
  38. 'id' => 'bottom',
  39. 'description' => 'Widgets in this area will be shown in the bottom section as a grid.',
  40. 'beans_type' => 'grid'
  41. ) );
  42.  
  43. }
  44.  
  45.  
  46. // Add admin layout option (filter)
  47. beans_add_smart_action( 'beans_layouts', 'banks_layouts' );
  48.  
  49. function banks_layouts( $layouts ) {
  50.  
  51. $layouts['banks_c'] = get_stylesheet_directory_uri() . '/assets/images/c.png';
  52.  
  53. return $layouts;
  54.  
  55. }
  56.  
  57.  
  58. // Set the default layout (filter)
  59. beans_add_smart_action( 'beans_default_layout', 'banks_default_layout' );
  60.  
  61. function banks_default_layout() {
  62.  
  63. return 'banks_c';
  64.  
  65. }
  66.  
  67.  
  68. // Remove page post type comment support
  69. beans_add_smart_action( 'init', 'banks_post_type_support' );
  70.  
  71. function banks_post_type_support() {
  72.  
  73. remove_post_type_support( 'page', 'comments' );
  74.  
  75. }
  76.  
  77.  
  78. // Setup document fragements, markups and attributes
  79. add_action( 'wp', 'banks_setup_document' );
  80.  
  81. function banks_setup_document() {
  82.  
  83. // Frontpage posts
  84. if ( is_home() )
  85. beans_remove_attribute( 'beans_post', 'class', 'uk-panel-box' );
  86.  
  87. // Site Logo
  88. beans_remove_attribute( 'beans_site_title_tag', 'class', 'uk-text-muted' );
  89.  
  90. // Breadcrumb
  91. beans_remove_action( 'beans_breadcrumb' );
  92.  
  93. // Post meta
  94. beans_add_attribute( 'beans_post_meta_date', 'class', 'uk-text-muted' );
  95.  
  96. // Search form
  97. beans_replace_attribute( 'beans_search_form', 'class', 'uk-form-icon uk-form-icon-flip', 'uk-display-inline-block' );
  98. beans_remove_markup( 'beans_search_form_input_icon' );
  99.  
  100. // Add grid min width for Banks slim content
  101. if ( beans_get_layout() == 'banks_c' )
  102. beans_add_attribute( 'beans_content', 'class', 'tm-centered-content' );
  103.  
  104. // Only applies to singular and not pages
  105. if ( is_singular() && !is_page() ) {
  106.  
  107. // Post title
  108. beans_add_attribute( 'beans_post_title', 'class', 'uk-margin-small-bottom' );
  109.  
  110. // Post navigation
  111. beans_add_attribute( 'beans_post_navigation', 'class', 'uk-grid-margin uk-margin-bottom-remove' );
  112.  
  113. // Post comments
  114. beans_add_attribute( 'beans_comments', 'class', 'uk-margin-bottom-remove' );
  115. beans_add_attribute( 'beans_comment_form_wrap', 'class', 'uk-contrast' );
  116. beans_add_attribute( 'beans_comment_form_submit', 'class', 'uk-button-large' );
  117. beans_add_attribute( 'beans_no_comment', 'class', 'tm-no-comments uk-text-center uk-text-large uk-block' );
  118.  
  119. }
  120. if ( get_bloginfo( 'description' ) )
  121. beans_add_attribute( 'beans_primary_menu', 'class', 'uk-margin-small-top' );
  122.  
  123. }
  124.  
  125.  
  126. // Add primaray menu search field
  127. beans_add_smart_action( 'beans_primary_menu_append_markup', 'banks_primary_menu_search' );
  128.  
  129. function banks_primary_menu_search() {
  130.  
  131. echo beans_open_markup( 'banks_menu_primary_search', 'div', array(
  132. 'class' => 'tm-search uk-visible-large uk-navbar-content',
  133. 'style' => 'display: none;'
  134. ) );
  135.  
  136. get_search_form();
  137.  
  138. echo beans_close_markup( 'banks_menu_primary_search', 'div' );
  139.  
  140. echo beans_open_markup( 'banks_menu_primary_search_toggle', 'div', array(
  141. 'class' => 'tm-search-toggle uk-visible-large uk-navbar-content uk-display-inline-block uk-contrast'
  142. ) );
  143.  
  144. echo beans_open_markup( 'banks_menu_primary_search_icon', 'i', array( 'class' => 'uk-icon-search' ) );
  145. echo beans_close_markup( 'banks_menu_primary_search_icon', 'i' );
  146.  
  147. echo beans_close_markup( 'banks_menu_primary_search_toggle', 'div' );
  148.  
  149. }
  150.  
  151.  
  152. // Remove comment after note (filter)
  153. beans_add_smart_action( 'comment_form_defaults', 'banks_comment_form_defaults' );
  154.  
  155. function banks_comment_form_defaults( $args ) {
  156.  
  157. $args['comment_notes_after'] = '';
  158.  
  159. return $args;
  160.  
  161. }
  162.  
  163.  
  164. // Add the bottom widget area
  165. beans_add_smart_action( 'beans_footer_before_markup', 'banks_bottom_widget_area' );
  166.  
  167. function banks_bottom_widget_area() {
  168.  
  169. // Stop here if no widget
  170. if( !beans_is_active_widget_area( 'bottom' ) )
  171. return;
  172.  
  173. echo beans_open_markup( 'banks_bottom', 'section', array( 'class' => 'tm-bottom uk-block uk-padding-bottom-remove' ) );
  174.  
  175. echo beans_open_markup( 'beans_fixed_wrap[_bottom]', 'div', 'class=uk-container uk-container-center' );
  176.  
  177. echo beans_widget_area( 'bottom' );
  178.  
  179. echo beans_close_markup( 'beans_fixed_wrap[_bottom]', 'div' );
  180.  
  181. echo beans_close_markup( 'banks_bottom', 'section' );
  182.  
  183. }
  184.  
  185.  
  186. // Add footer content (filter)
  187. beans_add_smart_action( 'beans_footer_credit_right_text_output', 'banks_footer' );
  188.  
  189. function banks_footer() { ?>
  190.  
  191. <a href="http://www.themebutler.com/themes/banks/" target="_blank" title="Banks theme for WordPress">Banks</a> theme for <a href="http://wordpress.org" target="_blank">WordPress</a>. Built-with <a href="http://www.getbeans.io/" title="Beans Framework for WordPress" target="_blank">Beans</a>.
  192.  
  193. <?php }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement