dbe7a6ec by Jeff Balicki

breadcrumbs

Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent a2449d33
......@@ -14522,6 +14522,26 @@ h1 + p, .h1 + p {
display: block;
}
.breadcrumb a {
font-family: "trade-gothic-next-condensed";
text-decoration: none;
color: #555555;
font-size: 14px;
line-height: 18px;
}
.breadcrumb .current {
font-family: "trade-gothic-next-condensed";
color: #555555;
font-size: 14px;
line-height: 18px;
}
.breadcrumb .delimiter {
font-family: "trade-gothic-next-condensed";
padding: 0px 5px;
font-size: 14px;
line-height: 18px;
}
.hero-container {
background-position: top right;
background-size: cover;
......@@ -14723,6 +14743,11 @@ h1 + p, .h1 + p {
padding: 20px 0px 10px 0px;
width: 80%;
}
@media only screen and (max-width: 800px) {
.c-accordion__content {
width: 100%;
}
}
.c-accordion__title:after {
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 {
.link-block.image-text .img {
background-size: cover;
background-position: center;
min-height: 300px;
}
.link-block.image-text .link {
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
require_once __DIR__.'/inc/filters.php';
add_action( 'template_redirect', 'redirect_to_specific_page' );
// add_action( 'template_redirect', 'redirect_to_specific_page' );
function redirect_to_specific_page() {
// function redirect_to_specific_page() {
if (! is_page('login') && !is_user_logged_in()) {
wp_redirect(home_url()."/login/", 301 );
exit;
}
}
// if (! is_page('login') && !is_user_logged_in()) {
// wp_redirect(home_url()."/login/", 301 );
// exit;
// }
// }
remove_action( 'um_logout_user_links', 'um_logout_user_links', 100 );
......
......@@ -76,3 +76,219 @@ class WPDocs_Walker_Nav_Menu extends Walker_Nav_Menu {
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
}
}
function get_hansel_and_gretel_breadcrumbs()
{
// Set variables for later use
$home_link = home_url('/');
$home_text = __( 'Home' );
$link_before = '';
$link_after = '';
$link_attr = ' rel="v:url" property="v:title"';
$link = $link_before . '<a' . $link_attr . ' href="%1$s">%2$s</a>' . $link_after;
$delimiter = '<span class="delimiter"> / </span>'; // Delimiter between crumbs
$before = '<span class="current">'; // Tag before the current crumb
$after = '</span>'; // Tag after the current crumb
$page_addon = ''; // Adds the page number if the query is paged
$breadcrumb_trail = '';
$category_links = '';
/**
* Set our own $wp_the_query variable. Do not use the global variable version due to
* reliability
*/
$wp_the_query = $GLOBALS['wp_the_query'];
$queried_object = $wp_the_query->get_queried_object();
// Handle single post requests which includes single pages, posts and attatchments
if ( is_singular() )
{
/**
* Set our own $post variable. Do not use the global variable version due to
* reliability. We will set $post_object variable to $GLOBALS['wp_the_query']
*/
$post_object = sanitize_post( $queried_object );
// Set variables
$title = apply_filters( 'the_title', $post_object->post_title );
$parent = $post_object->post_parent;
$post_type = $post_object->post_type;
$post_id = $post_object->ID;
$post_link = $before . $title . $after;
$parent_string = '';
$post_type_link = '';
if ( 'post' === $post_type )
{
// Get the post categories
$categories = get_the_category( $post_id );
if ( $categories ) {
// Lets grab the first category
$category = $categories[0];
$category_links = get_category_parents( $category, true, $delimiter );
$category_links = str_replace( '<a', $link_before . '<a' . $link_attr, $category_links );
$category_links = str_replace( '</a>', '</a>' . $link_after, $category_links );
}
}
if ( !in_array( $post_type, ['post', 'page', 'attachment'] ) )
{
$post_type_object = get_post_type_object( $post_type );
$archive_link = esc_url( get_post_type_archive_link( $post_type ) );
$post_type_link = sprintf( $link, $archive_link, $post_type_object->labels->singular_name );
}
// Get post parents if $parent !== 0
if ( 0 !== $parent )
{
$parent_links = [];
while ( $parent ) {
$post_parent = get_post( $parent );
$parent_links[] = sprintf( $link, esc_url( get_permalink( $post_parent->ID ) ), get_the_title( $post_parent->ID ) );
$parent = $post_parent->post_parent;
}
$parent_links = array_reverse( $parent_links );
$parent_string = implode( $delimiter, $parent_links );
}
// Lets build the breadcrumb trail
if ( $parent_string ) {
$breadcrumb_trail = $parent_string . $delimiter . $post_link;
} else {
$breadcrumb_trail = $post_link;
}
if ( $post_type_link )
$breadcrumb_trail = $post_type_link . $delimiter . $breadcrumb_trail;
if ( $category_links )
$breadcrumb_trail = $category_links . $breadcrumb_trail;
}
// Handle archives which includes category-, tag-, taxonomy-, date-, custom post type archives and author archives
if( is_archive() )
{
if ( is_category()
|| is_tag()
|| is_tax()
) {
// Set the variables for this section
$term_object = get_term( $queried_object );
$taxonomy = $term_object->taxonomy;
$term_id = $term_object->term_id;
$term_name = $term_object->name;
$term_parent = $term_object->parent;
$taxonomy_object = get_taxonomy( $taxonomy );
$current_term_link = $before . $taxonomy_object->labels->singular_name . ': ' . $term_name . $after;
$parent_term_string = '';
if ( 0 !== $term_parent )
{
// Get all the current term ancestors
$parent_term_links = [];
while ( $term_parent ) {
$term = get_term( $term_parent, $taxonomy );
$parent_term_links[] = sprintf( $link, esc_url( get_term_link( $term ) ), $term->name );
$term_parent = $term->parent;
}
$parent_term_links = array_reverse( $parent_term_links );
$parent_term_string = implode( $delimiter, $parent_term_links );
}
if ( $parent_term_string ) {
$breadcrumb_trail = $parent_term_string . $delimiter . $current_term_link;
} else {
$breadcrumb_trail = $current_term_link;
}
} elseif ( is_author() ) {
$breadcrumb_trail = __( 'Author archive for ') . $before . $queried_object->data->display_name . $after;
} elseif ( is_date() ) {
// Set default variables
$year = $wp_the_query->query_vars['year'];
$monthnum = $wp_the_query->query_vars['monthnum'];
$day = $wp_the_query->query_vars['day'];
// Get the month name if $monthnum has a value
if ( $monthnum ) {
$date_time = DateTime::createFromFormat( '!m', $monthnum );
$month_name = $date_time->format( 'F' );
}
if ( is_year() ) {
$breadcrumb_trail = $before . $year . $after;
} elseif( is_month() ) {
$year_link = sprintf( $link, esc_url( get_year_link( $year ) ), $year );
$breadcrumb_trail = $year_link . $delimiter . $before . $month_name . $after;
} elseif( is_day() ) {
$year_link = sprintf( $link, esc_url( get_year_link( $year ) ), $year );
$month_link = sprintf( $link, esc_url( get_month_link( $year, $monthnum ) ), $month_name );
$breadcrumb_trail = $year_link . $delimiter . $month_link . $delimiter . $before . $day . $after;
}
} elseif ( is_post_type_archive() ) {
$post_type = $wp_the_query->query_vars['post_type'];
$post_type_object = get_post_type_object( $post_type );
$breadcrumb_trail = $before . $post_type_object->labels->singular_name . $after;
}
}
// Handle the search page
if ( is_search() ) {
$breadcrumb_trail = __( 'Search query for: ' ) . $before . get_search_query() . $after;
}
// Handle 404's
if ( is_404() ) {
$breadcrumb_trail = $before . __( 'Error 404' ) . $after;
}
// Handle paged pages
if ( is_paged() ) {
$current_page = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : get_query_var( 'page' );
$page_addon = $before . sprintf( __( ' ( Page %s )' ), number_format_i18n( $current_page ) ) . $after;
}
$breadcrumb_output_link = '';
$breadcrumb_output_link .= '<div class="breadcrumb">';
if ( is_home()
|| is_front_page()
) {
// Do not show breadcrumbs on page one of home and frontpage
if ( is_paged() ) {
$breadcrumb_output_link .= $page_addon;
}
} else {
$breadcrumb_output_link .= $breadcrumb_trail;
$breadcrumb_output_link .= $page_addon;
}
$breadcrumb_output_link .= '</div><!-- .breadcrumbs -->';
return $breadcrumb_output_link;
}
\ No newline at end of file
......
......@@ -34,6 +34,8 @@ if ( is_page_template( 'page-templates/no-title.php' ) ) {
<main class="site-main" id="main" role="main">
<?php
echo get_hansel_and_gretel_breadcrumbs();
while ( have_posts() ) {
the_post();
get_template_part( 'loop-templates/content', 'page' );
......
......@@ -17,6 +17,9 @@
.c-accordion__content{
padding: 20px 0px 10px 0px;
width: 80%;
@media only screen and (max-width: 800px) {
width: 100%;
}
}
.c-accordion__title:after{
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");
......
......@@ -46,6 +46,7 @@
.img{
background-size: cover;
background-position:center;
min-height: 300px;
}
.link{
padding-top: 17px;
......
......@@ -149,3 +149,25 @@
.current-menu-item .wsmenu-submenu { display:block; }
.current-menu-ancestor .wsmenu-submenu { display:block; }
.breadcrumb{
a{
font-family:"trade-gothic-next-condensed";
text-decoration: none;
color:#555555;
font-size: 14px;
line-height: 18px;
}
.current{
font-family:"trade-gothic-next-condensed";
color:#555555;
font-size: 14px;
line-height: 18px;
}
.delimiter{
font-family:"trade-gothic-next-condensed";
padding:0px 5px;
font-size: 14px;
line-height: 18px;
}
}
......
......@@ -5,7 +5,7 @@
Author: the Understrap Contributors
Author URI: https://github.com/understrap/understrap-child/graphs/contributors
Template: understrap
Version: 1.2.0007
Version: 1.2.0008
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: understrap-child
......