srikat

Untitled

Nov 7th, 2016
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.76 KB | None | 0 0
  1. <?php
  2. //* Start the engine
  3. include_once( get_template_directory() . '/lib/init.php' );
  4.  
  5. //* Setup Theme
  6. include_once( get_stylesheet_directory() . '/lib/theme-defaults.php' );
  7.  
  8. //* Set Localization (do not remove)
  9. load_child_theme_textdomain( 'digital', apply_filters( 'child_theme_textdomain', get_stylesheet_directory() . '/languages', 'digital' ) );
  10.  
  11. //* Add Image upload and Color select to WordPress Theme Customizer
  12. require_once( get_stylesheet_directory() . '/lib/customize.php' );
  13.  
  14. //* Include Customizer CSS
  15. include_once( get_stylesheet_directory() . '/lib/output.php' );
  16.  
  17. //* Child theme (do not remove)
  18. define( 'CHILD_THEME_NAME', 'Digital Pro' );
  19. define( 'CHILD_THEME_URL', 'http://my.studiopress.com/themes/digital/' );
  20. define( 'CHILD_THEME_VERSION', '1.0.4' );
  21.  
  22. //* Enqueue scripts and styles
  23. add_action( 'wp_enqueue_scripts', 'digital_scripts_styles' );
  24. function digital_scripts_styles() {
  25.  
  26. wp_enqueue_style( 'google-fonts', '//fonts.googleapis.com/css?family=Lora:400,400italic,700,700italic|Poppins:400,500,600,700', array(), CHILD_THEME_VERSION );
  27. wp_enqueue_style( 'ionicons', '//code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css', array(), CHILD_THEME_VERSION );
  28.  
  29. wp_enqueue_script( 'digital-fadeup-script', get_stylesheet_directory_uri() . '/js/fadeup.js', array( 'jquery' ), '1.0.0', true );
  30. wp_enqueue_script( 'digital-site-header', get_stylesheet_directory_uri() . '/js/site-header.js', array( 'jquery' ), '1.0.0', true );
  31. wp_enqueue_script( 'digital-responsive-menu', get_stylesheet_directory_uri() . '/js/responsive-menu.js', array( 'jquery' ), '1.0.0', true );
  32. $output = array(
  33. 'mainMenu' => __( 'Menu', 'digital' ),
  34. 'subMenu' => __( 'Menu', 'digital' ),
  35. );
  36. wp_localize_script( 'digital-responsive-menu', 'DigitalL10n', $output );
  37.  
  38. }
  39.  
  40. //* Add HTML5 markup structure
  41. add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' ) );
  42.  
  43. //* Add accessibility support
  44. add_theme_support( 'genesis-accessibility', array( '404-page', 'drop-down-menu', 'headings', 'rems', 'search-form', 'skip-links' ) );
  45.  
  46. //* Add screen reader class to archive description
  47. add_filter( 'genesis_attr_author-archive-description', 'genesis_attributes_screen_reader_class' );
  48.  
  49. //* Add viewport meta tag for mobile browsers
  50. add_theme_support( 'genesis-responsive-viewport' );
  51.  
  52. //* Add support for custom header
  53. add_theme_support( 'custom-header', array(
  54. 'width' => 600,
  55. 'height' => 140,
  56. 'header-selector' => '.site-title a',
  57. 'header-text' => false,
  58. 'flex-height' => true,
  59. ) );
  60.  
  61. //* Add support for after entry widget
  62. add_theme_support( 'genesis-after-entry-widget-area' );
  63.  
  64. //* Rename primary and secondary navigation menus
  65. // add_theme_support( 'genesis-menus' , array( 'primary' => __( 'Header Menu', 'digital' ), 'secondary' => __( 'Footer Menu', 'digital' ) ) );
  66.  
  67. //* Remove output of primary navigation right extras
  68. remove_filter( 'genesis_nav_items', 'genesis_nav_right', 10, 2 );
  69. remove_filter( 'wp_nav_menu_items', 'genesis_nav_right', 10, 2 );
  70.  
  71. //* Remove navigation meta box
  72. add_action( 'genesis_theme_settings_metaboxes', 'digital_remove_genesis_metaboxes' );
  73. function digital_remove_genesis_metaboxes( $_genesis_theme_settings_pagehook ) {
  74.  
  75. remove_meta_box( 'genesis-theme-settings-nav', $_genesis_theme_settings_pagehook, 'main' );
  76.  
  77. }
  78.  
  79. //* Remove header right widget area
  80. unregister_sidebar( 'header-right' );
  81.  
  82. //* Add image sizes
  83. add_image_size( 'front-page-featured', 1000, 700, TRUE );
  84.  
  85. //* Reposition post image
  86. remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );
  87. add_action( 'genesis_entry_header', 'genesis_do_post_image', 4 );
  88.  
  89. //* Reposition primary navigation menu
  90. remove_action( 'genesis_after_header', 'genesis_do_nav' );
  91. add_action( 'genesis_header', 'genesis_do_nav', 12 );
  92.  
  93. //* Reposition secondary navigation menu
  94. remove_action( 'genesis_after_header', 'genesis_do_subnav' );
  95. // add_action( 'genesis_footer', 'genesis_do_subnav', 12 );
  96.  
  97. //* Reduce secondary navigation menu to one level depth
  98. add_filter( 'wp_nav_menu_args', 'digital_secondary_menu_args' );
  99. function digital_secondary_menu_args( $args ) {
  100.  
  101. if ( 'secondary' != $args['theme_location'] ) {
  102. return $args;
  103. }
  104.  
  105. $args['depth'] = 1;
  106.  
  107. return $args;
  108.  
  109. }
  110.  
  111. //* Remove skip link for primary navigation
  112. add_filter( 'genesis_skip_links_output', 'digital_skip_links_output' );
  113. function digital_skip_links_output( $links ) {
  114.  
  115. if ( isset( $links['genesis-nav-primary'] ) ) {
  116. unset( $links['genesis-nav-primary'] );
  117. }
  118.  
  119. return $links;
  120.  
  121. }
  122.  
  123. //* Remove seondary sidebar
  124. unregister_sidebar( 'sidebar-alt' );
  125.  
  126. //* Remove site layouts
  127. genesis_unregister_layout( 'content-sidebar-sidebar' );
  128. genesis_unregister_layout( 'sidebar-content-sidebar' );
  129. genesis_unregister_layout( 'sidebar-sidebar-content' );
  130.  
  131. //* Reposition entry meta in entry header
  132. remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
  133. add_action( 'genesis_entry_header', 'genesis_post_info', 8 );
  134.  
  135. //* Customize entry meta in the entry header
  136. add_filter( 'genesis_post_info', 'digital_entry_meta_header' );
  137. function digital_entry_meta_header( $post_info ) {
  138.  
  139. $post_info = '[post_author_posts_link] / [post_date] [post_edit]';
  140.  
  141. return $post_info;
  142.  
  143. }
  144.  
  145. //* Customize the content limit more markup
  146. add_filter( 'get_the_content_limit', 'digital_content_limit_read_more_markup', 10, 3 );
  147. function digital_content_limit_read_more_markup( $output, $content, $link ) {
  148.  
  149. $output = sprintf( '<p>%s &#x02026;</p><p class="more-link-wrap">%s</p>', $content, str_replace( '&#x02026;', '', $link ) );
  150.  
  151. return $output;
  152.  
  153. }
  154.  
  155. //* Customize author box title
  156. add_filter( 'genesis_author_box_title', 'digital_author_box_title' );
  157. function digital_author_box_title() {
  158.  
  159. return '<span itemprop="name">' . get_the_author() . '</span>';
  160.  
  161. }
  162.  
  163. //* Modify size of the Gravatar in the author box
  164. add_filter( 'genesis_author_box_gravatar_size', 'digital_author_box_gravatar' );
  165. function digital_author_box_gravatar( $size ) {
  166.  
  167. return 160;
  168.  
  169. }
  170.  
  171. //* Modify size of the Gravatar in the entry comments
  172. add_filter( 'genesis_comment_list_args', 'digital_comments_gravatar' );
  173. function digital_comments_gravatar( $args ) {
  174.  
  175. $args['avatar_size'] = 60;
  176.  
  177. return $args;
  178.  
  179. }
  180.  
  181. //* Remove entry meta in the entry footer on category pages
  182. add_action( 'genesis_before_entry', 'digital_remove_entry_footer' );
  183. function digital_remove_entry_footer() {
  184.  
  185. if ( is_front_page() || is_archive() || is_search() || is_page_template( 'page_blog.php' ) ) {
  186. remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_open', 5 );
  187. remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
  188. remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_close', 15 );
  189. }
  190.  
  191. }
  192.  
  193. //* Setup widget counts
  194. function digital_count_widgets( $id ) {
  195.  
  196. global $sidebars_widgets;
  197.  
  198. if ( isset( $sidebars_widgets[ $id ] ) ) {
  199. return count( $sidebars_widgets[ $id ] );
  200. }
  201.  
  202. }
  203.  
  204. //* Flexible widget classes
  205. function digital_widget_area_class( $id ) {
  206.  
  207. $count = digital_count_widgets( $id );
  208.  
  209. $class = '';
  210.  
  211. if ( $count == 1 ) {
  212. $class .= ' widget-full';
  213. } elseif ( $count % 3 == 1 ) {
  214. $class .= ' widget-thirds';
  215. } elseif ( $count % 4 == 1 ) {
  216. $class .= ' widget-fourths';
  217. } elseif ( $count % 2 == 0 ) {
  218. $class .= ' widget-halves uneven';
  219. } else {
  220. $class .= ' widget-halves even';
  221. }
  222.  
  223. return $class;
  224.  
  225. }
  226.  
  227. //* Flexible widget classes
  228. function digital_halves_widget_area_class( $id ) {
  229.  
  230. $count = digital_count_widgets( $id );
  231.  
  232. $class = '';
  233.  
  234. if ( $count == 1 ) {
  235. $class .= ' widget-full';
  236. } elseif ( $count % 2 == 0 ) {
  237. $class .= ' widget-halves';
  238. } else {
  239. $class .= ' widget-halves uneven';
  240. }
  241.  
  242. return $class;
  243.  
  244. }
  245.  
  246. //* Add support for 3-column footer widget
  247. add_theme_support( 'genesis-footer-widgets', 3 );
  248.  
  249. //* Register widget areas
  250. genesis_register_sidebar( array(
  251. 'id' => 'front-page-1',
  252. 'name' => __( 'Front Page 1', 'digital' ),
  253. 'description' => __( 'This is the 1st section on the front page.', 'digital' ),
  254. ) );
  255. genesis_register_sidebar( array(
  256. 'id' => 'front-page-2',
  257. 'name' => __( 'Front Page 2', 'digital' ),
  258. 'description' => __( 'This is the 2nd section on the front page.', 'digital' ),
  259. ) );
  260. genesis_register_sidebar( array(
  261. 'id' => 'front-page-3',
  262. 'name' => __( 'Front Page 3', 'digital' ),
  263. 'description' => __( 'This is the 3rd section on the front page.', 'digital' ),
  264. ) );
  265.  
  266.  
  267. add_action( 'genesis_header', 'sk_header_left_open', 7 );
  268. function sk_header_left_open() {
  269. echo '<div class="logo-nav">';
  270. }
  271.  
  272. add_action( 'genesis_header', 'sk_header_left_close', 12 );
  273. function sk_header_left_close() {
  274. echo '</div>';
  275. }
  276.  
  277. add_action( 'genesis_header', 'genesis_do_subnav', 12 );
Advertisement
Add Comment
Please, Sign In to add comment