%PDF- %PDF-
Direktori : /var/www/html/bbw/farmaci/wordpress/wp-content/themes/roots-kritik-portale/ |
Current File : /var/www/html/bbw/farmaci/wordpress/wp-content/themes/roots-kritik-portale/functions.php |
<?php /** * Roots includes * * The $roots_includes array determines the code library included in your theme. * Add or remove files to the array as needed. Supports child theme overrides. * * Please note that missing files will produce a fatal error. * * @link https://github.com/roots/roots/pull/1042 */ require KRIPO_APP_PATH; // basePath muss manuell auf das von der zf-Anwendung gesetzt werden, da asset uris nicht korrekt aufgelöst werden. Kripo::basePath('/'); // einmalig layout vom zf laden Kripo::loadLayout(); $roots_includes = array( 'lib/utils.php', // Utility functions 'lib/init.php', // Initial theme setup and constants 'lib/wrapper.php', // Theme wrapper class 'lib/sidebar.php', // Sidebar class 'lib/config.php', // Configuration 'lib/activation.php', // Theme activation 'lib/titles.php', // Page titles 'lib/nav.php', // Custom nav modifications 'lib/gallery.php', // Custom [gallery] modifications 'lib/scripts.php', // Scripts and stylesheets 'lib/extras.php', // Custom functions ); foreach ($roots_includes as $file) { if (!$filepath = locate_template($file)) { trigger_error(sprintf(__('Error locating %s for inclusion', 'roots'), $file), E_USER_ERROR); } require_once $filepath; } unset($file, $filepath); function custom_excerpt_length( $length ) { return 175; } add_filter( 'excerpt_length', 'custom_excerpt_length', 999 ); // add hook add_filter( 'wp_nav_menu_objects', 'my_wp_nav_menu_objects_sub_menu', 10, 2 ); // filter_hook function to react on sub_menu flag function my_wp_nav_menu_objects_sub_menu( $sorted_menu_items, $args ) { if ( isset( $args->sub_menu ) ) { $root_id = 0; // find the current menu item foreach ( $sorted_menu_items as $menu_item ) { if ( $menu_item->current ) { // set the root id based on whether the current menu item has a parent or not $root_id = ( $menu_item->menu_item_parent ) ? $menu_item->menu_item_parent : $menu_item->ID; break; } } // find the top level parent if ( ! isset( $args->direct_parent ) ) { $prev_root_id = $root_id; while ( $prev_root_id != 0 ) { foreach ( $sorted_menu_items as $menu_item ) { if ( $menu_item->ID == $prev_root_id ) { $prev_root_id = $menu_item->menu_item_parent; // don't set the root_id to 0 if we've reached the top of the menu if ( $prev_root_id != 0 ) $root_id = $menu_item->menu_item_parent; break; } } } } $menu_item_parents = array(); foreach ( $sorted_menu_items as $key => $item ) { // init menu_item_parents if ( $item->ID == $root_id ) $menu_item_parents[] = $item->ID; if ( in_array( $item->menu_item_parent, $menu_item_parents ) ) { // part of sub-tree: keep! $menu_item_parents[] = $item->ID; } else if ( ! ( isset( $args->show_parent ) && in_array( $item->ID, $menu_item_parents ) ) ) { // not part of sub-tree: away with it! unset( $sorted_menu_items[$key] ); } } return $sorted_menu_items; } else { return $sorted_menu_items; } } wp_dequeue_style('roots_css');