SHARE
TWEET

Interior Pro Display Word "Menu"

vfontjr Jan 15th, 2019 109 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /**
  3.  * Interior Pro.
  4.  *
  5.  * This file adds functions to the Interior Pro Theme.
  6.  *
  7.  * @package Interior
  8.  * @author  StudioPress
  9.  * @license GPL-2.0+
  10.  * @link    http://my.studiopress.com/themes/interior/
  11.  */
  12.  
  13. //* Start the engine
  14. include_once( get_template_directory() . '/lib/init.php' );
  15.  
  16. //* Setup Theme
  17. include_once( get_stylesheet_directory() . '/lib/theme-defaults.php' );
  18.  
  19. //* Set Localization (do not remove)
  20. load_child_theme_textdomain( 'interior', apply_filters( 'child_theme_textdomain', get_stylesheet_directory() . '/languages', 'interior' ) );
  21.  
  22. //* Add Image upload and Color select to WordPress Theme Customizer
  23. require_once( get_stylesheet_directory() . '/lib/customize.php' );
  24.  
  25. //* Include Customizer CSS
  26. include_once( get_stylesheet_directory() . '/lib/output.php' );
  27.  
  28. //* Child theme (do not remove)
  29. define( 'CHILD_THEME_NAME', 'Interior Pro Theme' );
  30. define( 'CHILD_THEME_URL', 'http://my.studiopress.com/themes/interior-pro/' );
  31. define( 'CHILD_THEME_VERSION', '1.0.0' );
  32.  
  33. //* Enqueue Google Fonts
  34. add_action( 'wp_enqueue_scripts', 'interior_enqueue_scripts_styles' );
  35. function interior_enqueue_scripts_styles() {
  36.  
  37.     wp_enqueue_style( 'interior-fonts', '//fonts.googleapis.com/css?family=Open+Sans:700|Lora:400,400italic,700|Homemade+Apple', array(), CHILD_THEME_VERSION );
  38.     wp_enqueue_style( 'ionicons', '//code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css', array(), CHILD_THEME_VERSION );
  39.  
  40.     wp_enqueue_script( 'interior-responsive-menu', get_stylesheet_directory_uri() . '/js/responsive-menu.js', array( 'jquery' ), '1.0.0', true );
  41.     $output = array(
  42.         'mainMenu' => __( 'Menu', 'interior' ),
  43.         'subMenu'  => __( 'Menu', 'interior' ),
  44.     );
  45.     // wp_localize_script( 'interior-responsive-menu', 'InteriorL10n', $output );
  46.  
  47.     wp_localize_script(
  48.         'interior-responsive-menu',
  49.         'genesis_responsive_menu',
  50.         interior_responsive_menu_settings()
  51.     );
  52.  
  53. }
  54.  
  55. function interior_responsive_menu_settings() {
  56.  
  57.     $settings = array(
  58.         'mainMenu'         => __( 'Menu', 'interior' ),
  59.         'menuIconClass'    => 'dashicons-before dashicons-menu',
  60.         'subMenu'          => __( 'Submenu', 'interior' ),
  61.         'subMenuIconClass' => 'dashicons-before dashicons-arrow-down-alt2',
  62.         'menuClasses'      => array(
  63.             'combine' => array(
  64.                 '.nav-primary',
  65.             ),
  66.             'others'  => array( '.nav-secondary' ),
  67.         ),
  68.     );
  69.  
  70.     return $settings;
  71.  
  72. }
  73.  
  74. //* Add HTML5 markup structure
  75. add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' ) );
  76.  
  77. //* Add Accessibility support
  78. add_theme_support( 'genesis-accessibility', array( '404-page', 'drop-down-menu', 'headings', 'rems', 'search-form', 'skip-links' ) );
  79.  
  80. //* Add viewport meta tag for mobile browsers
  81. add_theme_support( 'genesis-responsive-viewport' );
  82.  
  83. //* Add support for custom header
  84. add_theme_support( 'custom-header', array(
  85.     'width'           => 520,
  86.     'height'          => 140,
  87.     'header-selector' => '.site-title a',
  88.     'header-text'     => false,
  89.     'flex-height'     => true,
  90. ) );
  91.  
  92. //* Add support for custom background
  93. add_theme_support( 'custom-background' );
  94.  
  95. //* Add support for after entry widget
  96. add_theme_support( 'genesis-after-entry-widget-area' );
  97.  
  98. //* Add Image Sizes
  99. add_image_size( 'front-page-sq', 800, 800, TRUE );
  100. add_image_size( 'front-page-rec', 800, 400, TRUE );
  101. add_image_size( 'front-page-lg-rec', 1200, 600, TRUE );
  102.  
  103. //* Remove header right widget area
  104. unregister_sidebar( 'header-right' );
  105.  
  106. //* Remove secondary sidebar
  107. unregister_sidebar( 'sidebar-alt' );
  108.  
  109. //* Remove site layouts
  110. genesis_unregister_layout( 'content-sidebar-sidebar' );
  111. genesis_unregister_layout( 'sidebar-content-sidebar' );
  112. genesis_unregister_layout( 'sidebar-sidebar-content' );
  113.  
  114. //* Remove output of primary navigation right extras
  115. remove_filter( 'genesis_nav_items', 'genesis_nav_right', 10, 2 );
  116. remove_filter( 'wp_nav_menu_items', 'genesis_nav_right', 10, 2 );
  117.  
  118. //* Remove navigation meta box
  119. add_action( 'genesis_theme_settings_metaboxes', 'interior_remove_genesis_metaboxes' );
  120. function interior_remove_genesis_metaboxes( $_genesis_theme_settings_pagehook ) {
  121.  
  122.     remove_meta_box( 'genesis-theme-settings-nav', $_genesis_theme_settings_pagehook, 'main' );
  123.  
  124. }
  125.  
  126. //* Remove skip link for primary navigation and add skip link for footer widgets
  127. add_filter( 'genesis_skip_links_output', 'interior_skip_links_output' );
  128. function interior_skip_links_output( $links ) {
  129.  
  130.     if ( isset( $links['genesis-nav-primary'] ) ) {
  131.         unset( $links['genesis-nav-primary'] );
  132.     }
  133.  
  134.     $new_links = $links;
  135.     array_splice( $new_links, 3 );
  136.  
  137.     if ( is_active_sidebar( 'flex-footer' ) ) {
  138.         $new_links['footer'] = __( 'Skip to footer', 'interior' );
  139.     }
  140.  
  141.     return array_merge( $new_links, $links );
  142.  
  143. }
  144.  
  145. //* Rename primary and secondary navigation menus
  146. add_theme_support( 'genesis-menus' , array( 'primary' => __( 'Header Menu', 'interior' ), 'secondary' => __( 'Footer Menu', 'interior' ) ) );
  147.  
  148. //* Reposition primary navigation menu
  149. remove_action( 'genesis_after_header', 'genesis_do_nav' );
  150. add_action( 'genesis_header', 'genesis_do_nav', 12 );
  151.  
  152. //* Reposition the secondary navigation menu
  153. remove_action( 'genesis_after_header', 'genesis_do_subnav' );
  154. add_action( 'genesis_footer', 'genesis_do_subnav', 5 );
  155.  
  156. //* Reduce the secondary navigation menu to one level depth
  157. add_filter( 'wp_nav_menu_args', 'interior_secondary_menu_args' );
  158. function interior_secondary_menu_args( $args ) {
  159.  
  160.     if ( 'secondary' != $args['theme_location'] ) {
  161.         return $args;
  162.     }
  163.  
  164.     $args['depth'] = 1;
  165.  
  166.     return $args;
  167.  
  168. }
  169.  
  170. //* Setup widget counts
  171. function interior_count_widgets( $id ) {
  172.  
  173.     global $sidebars_widgets;
  174.  
  175.     if ( isset( $sidebars_widgets[ $id ] ) ) {
  176.         return count( $sidebars_widgets[ $id ] );
  177.     }
  178.  
  179. }
  180.  
  181. function interior_widget_area_class( $id ) {
  182.  
  183.     $count = interior_count_widgets( $id );
  184.  
  185.     $class = '';
  186.  
  187.     if ( $count == 1 ) {
  188.         $class .= ' widget-full';
  189.     } elseif ( $count % 3 == 0 ) {
  190.         $class .= ' widget-thirds';
  191.     } elseif ( $count % 4 == 0 ) {
  192.         $class .= ' widget-fourths';
  193.     } elseif ( $count % 2 == 1 ) {
  194.         $class .= ' widget-halves uneven';
  195.     } else {   
  196.         $class .= ' widget-halves';
  197.     }
  198.  
  199.     return $class;
  200.  
  201. }
  202.  
  203. //* Reposition Page Title
  204. add_action( 'genesis_meta', 'interior_page_description_meta' );
  205. function interior_page_description_meta() {
  206.  
  207.     if ( is_singular() && is_page() && !is_page_template() ) {
  208.         remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
  209.         add_action( 'genesis_after_header', 'genesis_do_post_title', 10 );
  210.     }
  211.  
  212. }
  213.  
  214. remove_action( 'genesis_before_loop', 'genesis_do_taxonomy_title_description', 15 );
  215. add_action( 'genesis_after_header', 'genesis_do_taxonomy_title_description', 10 );
  216. remove_action( 'genesis_before_loop', 'genesis_do_author_title_description', 15 );
  217. add_action( 'genesis_after_header', 'genesis_do_author_title_description', 10 );
  218.  
  219. add_action( 'genesis_after_header', 'interior_open_after_header', 5 );
  220. add_action( 'genesis_after_header', 'interior_close_after_header', 15 );
  221.  
  222. function interior_open_after_header() {
  223.     echo '<div class="after-header dark"><div class="wrap">';
  224. }
  225.  
  226. function interior_close_after_header() {
  227.     echo '</div></div>';
  228. }
  229.  
  230. //* Reposition Entry Meta
  231. remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
  232. remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
  233. add_action( 'genesis_entry_header', 'genesis_post_meta', 5 );
  234. add_action( 'genesis_entry_footer', 'genesis_post_info' );
  235.  
  236. //* Customize the entry meta in the entry footer (requires HTML5 theme support)
  237. add_filter( 'genesis_post_meta', 'interior_post_meta_filter' );
  238. function interior_post_meta_filter( $post_meta ) {
  239.  
  240.     $post_meta = '[post_categories before=""]';
  241.  
  242.     return $post_meta;
  243.  
  244. }
  245.  
  246. //* Customize the content limit more markup
  247. add_filter( 'get_the_content_limit', 'interior_content_limit_read_more_markup', 10, 3 );
  248. function interior_content_limit_read_more_markup( $output, $content, $link ) { 
  249.  
  250.     $output = sprintf( '<p>%s &#x02026;</p><p class="more-link-wrap">%s</p>', $content, str_replace( '&#x02026;', '', $link ) );
  251.  
  252.     return $output;
  253.  
  254. }
  255.  
  256. //* Add the footer widget area
  257. add_action( 'genesis_before_footer', 'interior_footer_widgets' );
  258. function interior_footer_widgets() {
  259.  
  260.     genesis_widget_area( 'before-footer', array(
  261.         'before' => '<div id="before-footer" class="before-footer dark"><h2 class="genesis-sidebar-title screen-reader-text">' . __( 'Before Footer', 'interior' ) . '</h2><div class="flexible-widgets widget-area ' . interior_widget_area_class( 'before-footer' ) . '"><div class="wrap">',
  262.         'after'  => '</div></div></div>',
  263.     ) );
  264.  
  265.     genesis_widget_area( 'flex-footer', array(
  266.         'before' => '<div id="footer" class="flex-footer footer-widgets"><h2 class="genesis-sidebar-title screen-reader-text">' . __( 'Footer', 'interior' ) . '</h2><div class="flexible-widgets widget-area ' . interior_widget_area_class( 'flex-footer' ) . '"><div class="wrap">',
  267.         'after'  => '</div></div></div>',
  268.     ) );
  269.  
  270. }
  271.  
  272. //* Register widget areas
  273. genesis_register_sidebar( array(
  274.     'id'          => 'front-page-1',
  275.     'name'        => __( 'Front Page 1', 'interior' ),
  276.     'description' => __( 'This is the front page 1 section.', 'interior' ),
  277. ) );
  278. genesis_register_sidebar( array(
  279.     'id'          => 'front-page-2',
  280.     'name'        => __( 'Front Page 2', 'interior' ),
  281.     'description' => __( 'This is the front page 2 section.', 'interior' ),
  282. ) );
  283. genesis_register_sidebar( array(
  284.     'id'          => 'front-page-3',
  285.     'name'        => __( 'Front Page 3', 'interior' ),
  286.     'description' => __( 'This is the front page 3 section.', 'interior' ),
  287. ) );
  288. genesis_register_sidebar( array(
  289.     'id'          => 'before-footer',
  290.     'name'        => __( 'Before Footer', 'interior' ),
  291.     'description' => __( 'This is the before footer section.', 'interior' ),
  292. ) );
  293. genesis_register_sidebar( array(
  294.     'id'          => 'flex-footer',
  295.     'name'        => __( 'Footer', 'interior' ),
  296.     'description' => __( 'This is the footer section.', 'interior' ),
  297. ) );
  298. genesis_register_sidebar( array(
  299.     'id'            => 'front-page-4',
  300.     'name'          => __( 'Front Page 4', 'interior' ),
  301.     'description'   => __( 'This is the front page fourth section', 'interior' ),
  302. ) );
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top