From 3b5b67051f8c6d168cb22086b96c177d120d039c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Connor=20B=C3=A4r?= Date: Fri, 23 Sep 2016 14:33:05 +0200 Subject: [PATCH] Bumps version to 1.4.4. --- components/content-section.php | 28 +++++++++++++++------------- inc/customizer.php | 6 +++--- inc/extras.php | 31 ++++++++----------------------- inc/jetpack.php | 3 +-- inc/template-tags.php | 31 +++++++++++++------------------ languages/de_DE.mo | Bin 4207 -> 4207 bytes languages/de_DE.po | 10 +++++----- languages/uwc-website.pot | 8 ++++---- readme.md | 8 ++++---- style.css | 2 +- 10 files changed, 54 insertions(+), 73 deletions(-) diff --git a/components/content-section.php b/components/content-section.php index c848d10..3bfbc49 100755 --- a/components/content-section.php +++ b/components/content-section.php @@ -28,14 +28,16 @@ @@ -51,22 +53,22 @@ // Loop through the rows of data. while ( have_rows( 'modules' ) ) : the_row(); - if ( get_row_layout() == 'text_image' ) : + if ( get_row_layout() === 'text_image' ) : get_template_part( 'components/module', 'textimage' ); - elseif ( get_row_layout() == 'quote' ) : + elseif ( get_row_layout() === 'quote' ) : get_template_part( 'components/module', 'quote' ); - elseif ( get_row_layout() == 'call_to_action' ) : + elseif ( get_row_layout() === 'call_to_action' ) : get_template_part( 'components/module', 'calltoaction' ); - elseif ( get_row_layout() == 'video' ) : + elseif ( get_row_layout() === 'video' ) : get_template_part( 'components/module', 'video' ); - elseif ( get_row_layout() == 'google_maps' ) : + elseif ( get_row_layout() === 'google_maps' ) : get_template_part( 'components/module', 'googlemaps' ); diff --git a/inc/customizer.php b/inc/customizer.php index 7541d0f..87a5bde 100755 --- a/inc/customizer.php +++ b/inc/customizer.php @@ -12,15 +12,15 @@ */ function uwc_website_customize_register( $wp_customize ) { $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; - $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; + $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; $wp_customize->add_setting( 'comments', array( 'default' => false, 'sanitize_callback' => 'esc_html', ) ); $wp_customize->add_section( 'uwc_website_theme_options' , array( - 'title' => __( 'Theme Options', 'uwc-website' ), - 'priority' => 30, + 'title' => __( 'Theme Options', 'uwc-website' ), + 'priority' => 30, ) ); $wp_customize->add_control( 'comments', diff --git a/inc/extras.php b/inc/extras.php index d9abbf7..76f53b3 100755 --- a/inc/extras.php +++ b/inc/extras.php @@ -65,7 +65,7 @@ function ( $matches ) { /** * Output a submenu with the child pages of the current page. - * From http://christianvarga.com/how-to-get-submenu-items-from-a-wordpress-menu-based-on-parent-or-sibling/ + * Adapted from http://christianvarga.com/how-to-get-submenu-items-from-a-wordpress-menu-based-on-parent-or-sibling/ * * @param array $sorted_menu_items The sorted menu defined in the wp_nav_menu. * @param array $args The arguments defined in the wp_nav_menu call. @@ -75,6 +75,7 @@ function uwc_website_wp_nav_menu_objects_sub_menu( $sorted_menu_items, $args ) { return $sorted_menu_items; } $root_id = 0; + // Find the current menu item. foreach ( $sorted_menu_items as $menu_item ) { if ( $menu_item->current ) { @@ -84,36 +85,20 @@ function uwc_website_wp_nav_menu_objects_sub_menu( $sorted_menu_items, $args ) { } } - // Find the top level parent. - if ( ! isset( $args->direct_parent ) ) { - $prev_root_id = $root_id; - while ( 0 !== $prev_root_id ) { - 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 ( 0 !== $prev_root_id ) { $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; + // Init menu_item_parents. + if ( $item->ID === $root_id ) { + $menu_item_parents[] = $item->ID; } - - if ( in_array( $item->menu_item_parent, $menu_item_parents, true ) ) { + if ( in_array( $item->menu_item_parent, $menu_item_parents ) ) { // Part of sub-tree: keep! $menu_item_parents[] = $item->ID; - } elseif ( ! ( isset( $args->show_parent ) && in_array( $item->ID, $menu_item_parents, true ) ) ) { + } elseif ( ! ( 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; } + return $sorted_menu_items; } add_filter( 'wp_nav_menu_objects', 'uwc_website_wp_nav_menu_objects_sub_menu', 10, 2 ); diff --git a/inc/jetpack.php b/inc/jetpack.php index 2fff215..eb14cba 100755 --- a/inc/jetpack.php +++ b/inc/jetpack.php @@ -63,7 +63,6 @@ function uwc_website_the_site_logo() { function uwc_website_social_menu() { if ( ! function_exists( 'jetpack_social_menu' ) ) { return; - } else { - jetpack_social_menu(); } + jetpack_social_menu(); } diff --git a/inc/template-tags.php b/inc/template-tags.php index d230074..6eb5d0e 100755 --- a/inc/template-tags.php +++ b/inc/template-tags.php @@ -36,31 +36,26 @@ function uwc_website_custom_logo() { * Prints HTML with links to previous and next pages for the current page. */ function uwc_website_page_navigation() { - $test = wp_get_nav_menu_items( 'header' ); + $menu_location = 'primary'; + $locations = get_nav_menu_locations(); + $menu = wp_get_nav_menu_object( $locations[ $menu_location ] ); + $pagelist = wp_get_nav_menu_items( $menu->term_id, array( 'order' => 'DESC' ) ); - $pagelist = get_pages( array( - 'sort_column' => 'menu_order', - 'sort_order' => 'asc', - ) ); - $pages = array(); - foreach ( $pagelist as $page ) { - $pages[] += $page->ID; - } + $current = array_search( get_the_ID(), array_column( $pagelist, 'object_id' ) ); - $current = array_search( get_the_ID(), $pages ); - $prev_id = $pages[ $current - 1 ]; - $next_id = $pages[ $current + 1 ]; + $previous = $current - 1; + $next = $current + 1; echo ''; @@ -136,12 +131,12 @@ function uwc_website_content_navigation( $text ) { $nodes = $dom->getElementsByTagName( 'a' ); $items = array(); foreach ( $nodes as $node ) { - if ( $node -> hasAttribute( 'id' ) == true ) { + if ( $node -> hasAttribute( 'id' ) === true ) { $id = $node -> getAttribute( 'id' ); $items[] = html_entity_decode( $id ); } } - if ( count( $items ) != 0 ) { + if ( count( $items ) !== 0 ) { echo '