Changeset 4483
- Timestamp:
- 11/23/2012 11:04:46 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/common/template-tags.php
r4482 r4483 1883 1883 if ( empty( $args['home_text'] ) ) { 1884 1884 1885 // Set home text to page title1886 1885 $front_id = get_option( 'page_on_front' ); 1886 1887 // Set home text to page title 1887 1888 if ( !empty( $front_id ) ) { 1888 1889 $pre_front_text = get_the_title( $front_id ); … … 1908 1909 1909 1910 // Root slug is also the front page 1910 if ( !empty( $front_id ) && ( $front_id == $root_id ) ) 1911 if ( !empty( $front_id ) && ( $front_id == $root_id ) ) { 1911 1912 $pre_include_root = false; 1913 } 1912 1914 1913 1915 // Don't show root if viewing forum archive 1914 if ( bbp_is_forum_archive() ) 1916 if ( bbp_is_forum_archive() ) { 1915 1917 $pre_include_root = false; 1918 } 1916 1919 1917 1920 // Don't show root if viewing page in place of forum archive 1918 if ( !empty( $root_id ) && ( ( is_single() || is_page() ) && ( $root_id == get_the_ID() ) ) ) 1921 if ( !empty( $root_id ) && ( ( is_single() || is_page() ) && ( $root_id == get_the_ID() ) ) ) { 1919 1922 $pre_include_root = false; 1923 } 1920 1924 1921 1925 /** Current Text ******************************************************/ … … 1971 1975 1972 1976 // Parse args 1973 $ defaults =array(1977 $r = bbp_parse_args( $args, array( 1974 1978 1975 1979 // HTML … … 2000 2004 'current_before' => '<span class="bbp-breadcrumb-current">', 2001 2005 'current_after' => '</span>', 2002 ); 2003 $r = bbp_parse_args( $args, $defaults, 'get_breadcrumb' ); 2004 extract( $r ); 2006 ), 'get_breadcrumb' ); 2005 2007 2006 2008 /** Ancestors *********************************************************/ 2007 2009 2008 2010 // Get post ancestors 2009 if ( is_page() || is_single() || bbp_is_forum_edit() || bbp_is_topic_edit() || bbp_is_reply_edit() ) 2011 if ( is_page() || is_single() || bbp_is_forum_edit() || bbp_is_topic_edit() || bbp_is_reply_edit() ) { 2010 2012 $ancestors = array_reverse( (array) get_post_ancestors( get_the_ID() ) ); 2013 } 2011 2014 2012 2015 // Do we want to include a link to home? 2013 if ( !empty( $include_home ) || empty( $home_text ) ) 2014 $crumbs[] = '<a href="' . trailingslashit( home_url() ) . '" class="bbp-breadcrumb-home">' . $home_text . '</a>'; 2016 if ( !empty( $r['include_home'] ) || empty( $r['home_text'] ) ) { 2017 $crumbs[] = '<a href="' . trailingslashit( home_url() ) . '" class="bbp-breadcrumb-home">' . $r['home_text'] . '</a>'; 2018 } 2015 2019 2016 2020 // Do we want to include a link to the forum root? 2017 if ( !empty( $ include_root ) || empty( $root_text) ) {2021 if ( !empty( $r['include_root'] ) || empty( $r['root_text'] ) ) { 2018 2022 2019 2023 // Page exists at root slug path, so use its permalink … … 2028 2032 2029 2033 // Add the breadcrumb 2030 $crumbs[] = '<a href="' . $root_url . '" class="bbp-breadcrumb-root">' . $r oot_text. '</a>';2034 $crumbs[] = '<a href="' . $root_url . '" class="bbp-breadcrumb-root">' . $r['root_text'] . '</a>'; 2031 2035 } 2032 2036 … … 2073 2077 2074 2078 // Add current page to breadcrumb 2075 if ( !empty( $include_current ) || empty( $pre_current_text ) ) 2076 $crumbs[] = $current_before . $current_text . $current_after; 2079 if ( !empty( $r['include_current'] ) || empty( $r['pre_current_text'] ) ) { 2080 $crumbs[] = $r['current_before'] . $r['current_text'] . $r['current_after']; 2081 } 2077 2082 2078 2083 /** Separator *********************************************************/ 2079 2084 2080 2085 // Wrap the separator in before/after before padding and filter 2081 if ( ! empty( $sep ) ) 2082 $sep = $sep_before . $sep . $sep_after; 2086 if ( ! empty( $r['sep'] ) ) { 2087 $sep = $r['sep_before'] . $r['sep'] . $r['sep_after']; 2088 } 2083 2089 2084 2090 // Pad the separator 2085 if ( !empty( $pad_sep ) ) 2086 $sep = str_pad( $sep, strlen( $sep ) + ( (int) $pad_sep * 2 ), ' ', STR_PAD_BOTH ); 2091 if ( !empty( $r['pad_sep'] ) ) { 2092 $sep = str_pad( $sep, strlen( $sep ) + ( (int) $r['pad_sep'] * 2 ), ' ', STR_PAD_BOTH ); 2093 } 2087 2094 2088 2095 /** Finish Up *********************************************************/ … … 2093 2100 2094 2101 // Build the trail 2095 $trail = !empty( $crumbs ) ? ( $ before . $crumb_before . implode( $sep . $crumb_after . $crumb_before , $crumbs ) . $crumb_after . $after) : '';2102 $trail = !empty( $crumbs ) ? ( $r['before'] . $r['crumb_before'] . implode( $sep . $r['crumb_after'] . $r['crumb_before'] , $crumbs ) . $r['crumb_after'] . $r['after'] ) : ''; 2096 2103 2097 2104 return apply_filters( 'bbp_get_breadcrumb', $trail, $crumbs, $r );
Note: See TracChangeset
for help on using the changeset viewer.