breadcrumbs
Signed-off-by: Jeff <jeff@gotenzing.com>
Showing
12 changed files
with
278 additions
and
8 deletions
| ... | @@ -14522,6 +14522,26 @@ h1 + p, .h1 + p { | ... | @@ -14522,6 +14522,26 @@ h1 + p, .h1 + p { |
| 14522 | display: block; | 14522 | display: block; |
| 14523 | } | 14523 | } |
| 14524 | 14524 | ||
| 14525 | .breadcrumb a { | ||
| 14526 | font-family: "trade-gothic-next-condensed"; | ||
| 14527 | text-decoration: none; | ||
| 14528 | color: #555555; | ||
| 14529 | font-size: 14px; | ||
| 14530 | line-height: 18px; | ||
| 14531 | } | ||
| 14532 | .breadcrumb .current { | ||
| 14533 | font-family: "trade-gothic-next-condensed"; | ||
| 14534 | color: #555555; | ||
| 14535 | font-size: 14px; | ||
| 14536 | line-height: 18px; | ||
| 14537 | } | ||
| 14538 | .breadcrumb .delimiter { | ||
| 14539 | font-family: "trade-gothic-next-condensed"; | ||
| 14540 | padding: 0px 5px; | ||
| 14541 | font-size: 14px; | ||
| 14542 | line-height: 18px; | ||
| 14543 | } | ||
| 14544 | |||
| 14525 | .hero-container { | 14545 | .hero-container { |
| 14526 | background-position: top right; | 14546 | background-position: top right; |
| 14527 | background-size: cover; | 14547 | background-size: cover; |
| ... | @@ -14723,6 +14743,11 @@ h1 + p, .h1 + p { | ... | @@ -14723,6 +14743,11 @@ h1 + p, .h1 + p { |
| 14723 | padding: 20px 0px 10px 0px; | 14743 | padding: 20px 0px 10px 0px; |
| 14724 | width: 80%; | 14744 | width: 80%; |
| 14725 | } | 14745 | } |
| 14746 | @media only screen and (max-width: 800px) { | ||
| 14747 | .c-accordion__content { | ||
| 14748 | width: 100%; | ||
| 14749 | } | ||
| 14750 | } | ||
| 14726 | 14751 | ||
| 14727 | .c-accordion__title:after { | 14752 | .c-accordion__title:after { |
| 14728 | content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='10.636' viewBox='0 0 18 10.636'%3E%3Cpath id='Path_6' data-name='Path 6' d='M392.848 305.425a1.532 1.532 0 0 1-2.227 0l-7.443-7.386a1.572 1.572 0 0 1 0-2.268l7.443-7.386a1.532 1.532 0 0 1 2.227 0 1.5 1.5 0 0 1 0 2.21l-6.329 6.281 6.329 6.339A1.5 1.5 0 0 1 392.848 305.425Z' transform='translate(-287.905 393.331) rotate(-90)' fill='%23183668'/%3E%3C/svg%3E"); | 14753 | content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='10.636' viewBox='0 0 18 10.636'%3E%3Cpath id='Path_6' data-name='Path 6' d='M392.848 305.425a1.532 1.532 0 0 1-2.227 0l-7.443-7.386a1.572 1.572 0 0 1 0-2.268l7.443-7.386a1.532 1.532 0 0 1 2.227 0 1.5 1.5 0 0 1 0 2.21l-6.329 6.281 6.329 6.339A1.5 1.5 0 0 1 392.848 305.425Z' transform='translate(-287.905 393.331) rotate(-90)' fill='%23183668'/%3E%3C/svg%3E"); |
| ... | @@ -14788,6 +14813,7 @@ h2 + .wp-block-pb-accordion-item, .h2 + .wp-block-pb-accordion-item { | ... | @@ -14788,6 +14813,7 @@ h2 + .wp-block-pb-accordion-item, .h2 + .wp-block-pb-accordion-item { |
| 14788 | .link-block.image-text .img { | 14813 | .link-block.image-text .img { |
| 14789 | background-size: cover; | 14814 | background-size: cover; |
| 14790 | background-position: center; | 14815 | background-position: center; |
| 14816 | min-height: 300px; | ||
| 14791 | } | 14817 | } |
| 14792 | .link-block.image-text .link { | 14818 | .link-block.image-text .link { |
| 14793 | padding-top: 17px; | 14819 | padding-top: 17px; | ... | ... |
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
| ... | @@ -99,15 +99,15 @@ add_action( 'customize_controls_enqueue_scripts', 'understrap_child_customize_co | ... | @@ -99,15 +99,15 @@ add_action( 'customize_controls_enqueue_scripts', 'understrap_child_customize_co |
| 99 | 99 | ||
| 100 | require_once __DIR__.'/inc/filters.php'; | 100 | require_once __DIR__.'/inc/filters.php'; |
| 101 | 101 | ||
| 102 | add_action( 'template_redirect', 'redirect_to_specific_page' ); | 102 | // add_action( 'template_redirect', 'redirect_to_specific_page' ); |
| 103 | 103 | ||
| 104 | function redirect_to_specific_page() { | 104 | // function redirect_to_specific_page() { |
| 105 | 105 | ||
| 106 | if (! is_page('login') && !is_user_logged_in()) { | 106 | // if (! is_page('login') && !is_user_logged_in()) { |
| 107 | wp_redirect(home_url()."/login/", 301 ); | 107 | // wp_redirect(home_url()."/login/", 301 ); |
| 108 | exit; | 108 | // exit; |
| 109 | } | 109 | // } |
| 110 | } | 110 | // } |
| 111 | 111 | ||
| 112 | 112 | ||
| 113 | remove_action( 'um_logout_user_links', 'um_logout_user_links', 100 ); | 113 | remove_action( 'um_logout_user_links', 'um_logout_user_links', 100 ); | ... | ... |
1.04 KB
| ... | @@ -76,3 +76,219 @@ class WPDocs_Walker_Nav_Menu extends Walker_Nav_Menu { | ... | @@ -76,3 +76,219 @@ class WPDocs_Walker_Nav_Menu extends Walker_Nav_Menu { |
| 76 | $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args ); | 76 | $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args ); |
| 77 | } | 77 | } |
| 78 | } | 78 | } |
| 79 | |||
| 80 | |||
| 81 | function get_hansel_and_gretel_breadcrumbs() | ||
| 82 | { | ||
| 83 | // Set variables for later use | ||
| 84 | |||
| 85 | $home_link = home_url('/'); | ||
| 86 | $home_text = __( 'Home' ); | ||
| 87 | $link_before = ''; | ||
| 88 | $link_after = ''; | ||
| 89 | $link_attr = ' rel="v:url" property="v:title"'; | ||
| 90 | $link = $link_before . '<a' . $link_attr . ' href="%1$s">%2$s</a>' . $link_after; | ||
| 91 | $delimiter = '<span class="delimiter"> / </span>'; // Delimiter between crumbs | ||
| 92 | $before = '<span class="current">'; // Tag before the current crumb | ||
| 93 | $after = '</span>'; // Tag after the current crumb | ||
| 94 | $page_addon = ''; // Adds the page number if the query is paged | ||
| 95 | $breadcrumb_trail = ''; | ||
| 96 | $category_links = ''; | ||
| 97 | |||
| 98 | /** | ||
| 99 | * Set our own $wp_the_query variable. Do not use the global variable version due to | ||
| 100 | * reliability | ||
| 101 | */ | ||
| 102 | $wp_the_query = $GLOBALS['wp_the_query']; | ||
| 103 | $queried_object = $wp_the_query->get_queried_object(); | ||
| 104 | |||
| 105 | // Handle single post requests which includes single pages, posts and attatchments | ||
| 106 | if ( is_singular() ) | ||
| 107 | { | ||
| 108 | /** | ||
| 109 | * Set our own $post variable. Do not use the global variable version due to | ||
| 110 | * reliability. We will set $post_object variable to $GLOBALS['wp_the_query'] | ||
| 111 | */ | ||
| 112 | $post_object = sanitize_post( $queried_object ); | ||
| 113 | |||
| 114 | // Set variables | ||
| 115 | $title = apply_filters( 'the_title', $post_object->post_title ); | ||
| 116 | $parent = $post_object->post_parent; | ||
| 117 | $post_type = $post_object->post_type; | ||
| 118 | $post_id = $post_object->ID; | ||
| 119 | $post_link = $before . $title . $after; | ||
| 120 | $parent_string = ''; | ||
| 121 | $post_type_link = ''; | ||
| 122 | |||
| 123 | if ( 'post' === $post_type ) | ||
| 124 | { | ||
| 125 | // Get the post categories | ||
| 126 | $categories = get_the_category( $post_id ); | ||
| 127 | if ( $categories ) { | ||
| 128 | // Lets grab the first category | ||
| 129 | $category = $categories[0]; | ||
| 130 | |||
| 131 | $category_links = get_category_parents( $category, true, $delimiter ); | ||
| 132 | $category_links = str_replace( '<a', $link_before . '<a' . $link_attr, $category_links ); | ||
| 133 | $category_links = str_replace( '</a>', '</a>' . $link_after, $category_links ); | ||
| 134 | } | ||
| 135 | } | ||
| 136 | |||
| 137 | if ( !in_array( $post_type, ['post', 'page', 'attachment'] ) ) | ||
| 138 | { | ||
| 139 | $post_type_object = get_post_type_object( $post_type ); | ||
| 140 | $archive_link = esc_url( get_post_type_archive_link( $post_type ) ); | ||
| 141 | |||
| 142 | $post_type_link = sprintf( $link, $archive_link, $post_type_object->labels->singular_name ); | ||
| 143 | } | ||
| 144 | |||
| 145 | // Get post parents if $parent !== 0 | ||
| 146 | if ( 0 !== $parent ) | ||
| 147 | { | ||
| 148 | $parent_links = []; | ||
| 149 | while ( $parent ) { | ||
| 150 | $post_parent = get_post( $parent ); | ||
| 151 | |||
| 152 | $parent_links[] = sprintf( $link, esc_url( get_permalink( $post_parent->ID ) ), get_the_title( $post_parent->ID ) ); | ||
| 153 | |||
| 154 | $parent = $post_parent->post_parent; | ||
| 155 | } | ||
| 156 | |||
| 157 | $parent_links = array_reverse( $parent_links ); | ||
| 158 | |||
| 159 | $parent_string = implode( $delimiter, $parent_links ); | ||
| 160 | } | ||
| 161 | |||
| 162 | // Lets build the breadcrumb trail | ||
| 163 | if ( $parent_string ) { | ||
| 164 | $breadcrumb_trail = $parent_string . $delimiter . $post_link; | ||
| 165 | } else { | ||
| 166 | $breadcrumb_trail = $post_link; | ||
| 167 | } | ||
| 168 | |||
| 169 | if ( $post_type_link ) | ||
| 170 | $breadcrumb_trail = $post_type_link . $delimiter . $breadcrumb_trail; | ||
| 171 | |||
| 172 | if ( $category_links ) | ||
| 173 | $breadcrumb_trail = $category_links . $breadcrumb_trail; | ||
| 174 | } | ||
| 175 | |||
| 176 | // Handle archives which includes category-, tag-, taxonomy-, date-, custom post type archives and author archives | ||
| 177 | if( is_archive() ) | ||
| 178 | { | ||
| 179 | if ( is_category() | ||
| 180 | || is_tag() | ||
| 181 | || is_tax() | ||
| 182 | ) { | ||
| 183 | // Set the variables for this section | ||
| 184 | $term_object = get_term( $queried_object ); | ||
| 185 | $taxonomy = $term_object->taxonomy; | ||
| 186 | $term_id = $term_object->term_id; | ||
| 187 | $term_name = $term_object->name; | ||
| 188 | $term_parent = $term_object->parent; | ||
| 189 | $taxonomy_object = get_taxonomy( $taxonomy ); | ||
| 190 | $current_term_link = $before . $taxonomy_object->labels->singular_name . ': ' . $term_name . $after; | ||
| 191 | $parent_term_string = ''; | ||
| 192 | |||
| 193 | if ( 0 !== $term_parent ) | ||
| 194 | { | ||
| 195 | // Get all the current term ancestors | ||
| 196 | $parent_term_links = []; | ||
| 197 | while ( $term_parent ) { | ||
| 198 | $term = get_term( $term_parent, $taxonomy ); | ||
| 199 | |||
| 200 | $parent_term_links[] = sprintf( $link, esc_url( get_term_link( $term ) ), $term->name ); | ||
| 201 | |||
| 202 | $term_parent = $term->parent; | ||
| 203 | } | ||
| 204 | |||
| 205 | $parent_term_links = array_reverse( $parent_term_links ); | ||
| 206 | $parent_term_string = implode( $delimiter, $parent_term_links ); | ||
| 207 | } | ||
| 208 | |||
| 209 | if ( $parent_term_string ) { | ||
| 210 | $breadcrumb_trail = $parent_term_string . $delimiter . $current_term_link; | ||
| 211 | } else { | ||
| 212 | $breadcrumb_trail = $current_term_link; | ||
| 213 | } | ||
| 214 | |||
| 215 | } elseif ( is_author() ) { | ||
| 216 | |||
| 217 | $breadcrumb_trail = __( 'Author archive for ') . $before . $queried_object->data->display_name . $after; | ||
| 218 | |||
| 219 | } elseif ( is_date() ) { | ||
| 220 | // Set default variables | ||
| 221 | $year = $wp_the_query->query_vars['year']; | ||
| 222 | $monthnum = $wp_the_query->query_vars['monthnum']; | ||
| 223 | $day = $wp_the_query->query_vars['day']; | ||
| 224 | |||
| 225 | // Get the month name if $monthnum has a value | ||
| 226 | if ( $monthnum ) { | ||
| 227 | $date_time = DateTime::createFromFormat( '!m', $monthnum ); | ||
| 228 | $month_name = $date_time->format( 'F' ); | ||
| 229 | } | ||
| 230 | |||
| 231 | if ( is_year() ) { | ||
| 232 | |||
| 233 | $breadcrumb_trail = $before . $year . $after; | ||
| 234 | |||
| 235 | } elseif( is_month() ) { | ||
| 236 | |||
| 237 | $year_link = sprintf( $link, esc_url( get_year_link( $year ) ), $year ); | ||
| 238 | |||
| 239 | $breadcrumb_trail = $year_link . $delimiter . $before . $month_name . $after; | ||
| 240 | |||
| 241 | } elseif( is_day() ) { | ||
| 242 | |||
| 243 | $year_link = sprintf( $link, esc_url( get_year_link( $year ) ), $year ); | ||
| 244 | $month_link = sprintf( $link, esc_url( get_month_link( $year, $monthnum ) ), $month_name ); | ||
| 245 | |||
| 246 | $breadcrumb_trail = $year_link . $delimiter . $month_link . $delimiter . $before . $day . $after; | ||
| 247 | } | ||
| 248 | |||
| 249 | } elseif ( is_post_type_archive() ) { | ||
| 250 | |||
| 251 | $post_type = $wp_the_query->query_vars['post_type']; | ||
| 252 | $post_type_object = get_post_type_object( $post_type ); | ||
| 253 | |||
| 254 | $breadcrumb_trail = $before . $post_type_object->labels->singular_name . $after; | ||
| 255 | |||
| 256 | } | ||
| 257 | } | ||
| 258 | |||
| 259 | // Handle the search page | ||
| 260 | if ( is_search() ) { | ||
| 261 | $breadcrumb_trail = __( 'Search query for: ' ) . $before . get_search_query() . $after; | ||
| 262 | } | ||
| 263 | |||
| 264 | // Handle 404's | ||
| 265 | if ( is_404() ) { | ||
| 266 | $breadcrumb_trail = $before . __( 'Error 404' ) . $after; | ||
| 267 | } | ||
| 268 | |||
| 269 | // Handle paged pages | ||
| 270 | if ( is_paged() ) { | ||
| 271 | $current_page = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : get_query_var( 'page' ); | ||
| 272 | $page_addon = $before . sprintf( __( ' ( Page %s )' ), number_format_i18n( $current_page ) ) . $after; | ||
| 273 | } | ||
| 274 | |||
| 275 | $breadcrumb_output_link = ''; | ||
| 276 | $breadcrumb_output_link .= '<div class="breadcrumb">'; | ||
| 277 | if ( is_home() | ||
| 278 | || is_front_page() | ||
| 279 | ) { | ||
| 280 | // Do not show breadcrumbs on page one of home and frontpage | ||
| 281 | if ( is_paged() ) { | ||
| 282 | |||
| 283 | |||
| 284 | $breadcrumb_output_link .= $page_addon; | ||
| 285 | } | ||
| 286 | } else { | ||
| 287 | |||
| 288 | $breadcrumb_output_link .= $breadcrumb_trail; | ||
| 289 | $breadcrumb_output_link .= $page_addon; | ||
| 290 | } | ||
| 291 | $breadcrumb_output_link .= '</div><!-- .breadcrumbs -->'; | ||
| 292 | |||
| 293 | return $breadcrumb_output_link; | ||
| 294 | } | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -34,6 +34,8 @@ if ( is_page_template( 'page-templates/no-title.php' ) ) { | ... | @@ -34,6 +34,8 @@ if ( is_page_template( 'page-templates/no-title.php' ) ) { |
| 34 | <main class="site-main" id="main" role="main"> | 34 | <main class="site-main" id="main" role="main"> |
| 35 | 35 | ||
| 36 | <?php | 36 | <?php |
| 37 | echo get_hansel_and_gretel_breadcrumbs(); | ||
| 38 | |||
| 37 | while ( have_posts() ) { | 39 | while ( have_posts() ) { |
| 38 | the_post(); | 40 | the_post(); |
| 39 | get_template_part( 'loop-templates/content', 'page' ); | 41 | get_template_part( 'loop-templates/content', 'page' ); | ... | ... |
| ... | @@ -17,6 +17,9 @@ | ... | @@ -17,6 +17,9 @@ |
| 17 | .c-accordion__content{ | 17 | .c-accordion__content{ |
| 18 | padding: 20px 0px 10px 0px; | 18 | padding: 20px 0px 10px 0px; |
| 19 | width: 80%; | 19 | width: 80%; |
| 20 | @media only screen and (max-width: 800px) { | ||
| 21 | width: 100%; | ||
| 22 | } | ||
| 20 | } | 23 | } |
| 21 | .c-accordion__title:after{ | 24 | .c-accordion__title:after{ |
| 22 | content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='10.636' viewBox='0 0 18 10.636'%3E%3Cpath id='Path_6' data-name='Path 6' d='M392.848 305.425a1.532 1.532 0 0 1-2.227 0l-7.443-7.386a1.572 1.572 0 0 1 0-2.268l7.443-7.386a1.532 1.532 0 0 1 2.227 0 1.5 1.5 0 0 1 0 2.21l-6.329 6.281 6.329 6.339A1.5 1.5 0 0 1 392.848 305.425Z' transform='translate(-287.905 393.331) rotate(-90)' fill='%23183668'/%3E%3C/svg%3E"); | 25 | content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='10.636' viewBox='0 0 18 10.636'%3E%3Cpath id='Path_6' data-name='Path 6' d='M392.848 305.425a1.532 1.532 0 0 1-2.227 0l-7.443-7.386a1.572 1.572 0 0 1 0-2.268l7.443-7.386a1.532 1.532 0 0 1 2.227 0 1.5 1.5 0 0 1 0 2.21l-6.329 6.281 6.329 6.339A1.5 1.5 0 0 1 392.848 305.425Z' transform='translate(-287.905 393.331) rotate(-90)' fill='%23183668'/%3E%3C/svg%3E"); | ... | ... |
| ... | @@ -149,3 +149,25 @@ | ... | @@ -149,3 +149,25 @@ |
| 149 | .current-menu-item .wsmenu-submenu { display:block; } | 149 | .current-menu-item .wsmenu-submenu { display:block; } |
| 150 | .current-menu-ancestor .wsmenu-submenu { display:block; } | 150 | .current-menu-ancestor .wsmenu-submenu { display:block; } |
| 151 | 151 | ||
| 152 | |||
| 153 | .breadcrumb{ | ||
| 154 | a{ | ||
| 155 | font-family:"trade-gothic-next-condensed"; | ||
| 156 | text-decoration: none; | ||
| 157 | color:#555555; | ||
| 158 | font-size: 14px; | ||
| 159 | line-height: 18px; | ||
| 160 | } | ||
| 161 | .current{ | ||
| 162 | font-family:"trade-gothic-next-condensed"; | ||
| 163 | color:#555555; | ||
| 164 | font-size: 14px; | ||
| 165 | line-height: 18px; | ||
| 166 | } | ||
| 167 | .delimiter{ | ||
| 168 | font-family:"trade-gothic-next-condensed"; | ||
| 169 | padding:0px 5px; | ||
| 170 | font-size: 14px; | ||
| 171 | line-height: 18px; | ||
| 172 | } | ||
| 173 | } | ... | ... |
| ... | @@ -5,7 +5,7 @@ | ... | @@ -5,7 +5,7 @@ |
| 5 | Author: the Understrap Contributors | 5 | Author: the Understrap Contributors |
| 6 | Author URI: https://github.com/understrap/understrap-child/graphs/contributors | 6 | Author URI: https://github.com/understrap/understrap-child/graphs/contributors |
| 7 | Template: understrap | 7 | Template: understrap |
| 8 | Version: 1.2.0007 | 8 | Version: 1.2.0008 |
| 9 | License: GNU General Public License v2 or later | 9 | License: GNU General Public License v2 or later |
| 10 | License URI: http://www.gnu.org/licenses/gpl-2.0.html | 10 | License URI: http://www.gnu.org/licenses/gpl-2.0.html |
| 11 | Text Domain: understrap-child | 11 | Text Domain: understrap-child | ... | ... |
-
Please register or sign in to post a comment