Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
xwolfde committed Jan 10, 2022
1 parent cd02d3c commit 8fc0df0
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 6 deletions.
54 changes: 54 additions & 0 deletions functions/template-functions.php
Expand Up @@ -1819,6 +1819,60 @@ function fau_get_image_fallback_htmlcode($size = 'rwd-480-3-2', $alttext = '', $

return;
}

/*-----------------------------------------------------------------------------------*/
/* Tag List with title-Attribute fot better A11y, see
* https://github.com/RRZE-Webteam/FAU-Einrichtungen/issues/949
*/
/*-----------------------------------------------------------------------------------*/
function fau_get_the_taglist($before = '', $sep = '', $after = '') {
$terms = get_the_tags();

$res = '';



if ( ! is_wp_error( $terms ) && ! empty( $terms ) ) { // Check if $terms is OK.

if (!empty($before)) {
$res .= $before;
}

if (empty($sep)) {
// use list
$res .= '<ul>';
}


foreach ( $terms as $term ) {
$link = get_term_link( $term );
if ( is_wp_error( $link ) ) {
continue;
}
if (empty($sep)) {
// use list
$res .= '<li>';
}
$res .= '<a href="' . esc_url( $link ) . '" rel="tag" title="'.__('Schlagwort','fau').' '.$term->name.'">' . $term->name . '</a>';
if (empty($sep)) {
// use list
$res .= '<li>';
} else {
$res .= $sep;
}
}
if (empty($sep)) {
// use list
$res .= '</ul>';
}

if (!empty($after)) {
$res .= $after;
}

}
return $res;
}
/*-----------------------------------------------------------------------------------*/
/* This is the end :)
/*-----------------------------------------------------------------------------------*/
2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "FAU-Einrichtungen",
"textdomain": "fau",
"version": "2.0.4-29",
"version": "2.0.4-30",
"keywords": [
"WordPress",
"Theme",
Expand Down
9 changes: 5 additions & 4 deletions single.php
Expand Up @@ -83,17 +83,18 @@
$typestr .= ': ';

foreach($categories as $category) {
$thiscatstr .= '<a href="'.get_category_link( $category->term_id ).'">'.$category->cat_name.'</a>'.$separator;
$thiscatstr .= '<a href="'.get_category_link( $category->term_id ).'" title="'.__('Kategorie', 'fau').' '.$category->cat_name.'">'.$category->cat_name.'</a>'.$separator;
}
$typestr .= trim($thiscatstr, $separator);
$typestr .= '</span> ';
}
}
if (get_theme_mod('post_display_tags_below')) {
$showfooter = true;
if(get_the_tag_list()) {
$taglist = get_the_tag_list('<span class="post-meta-tags"> '.__('Schlagworte', 'fau').': ',', ','</span>');
}
$taglist = fau_get_the_taglist('<span class="post-meta-tags"> '.__('Schlagworte', 'fau').': ',', ','</span>');
// if(get_the_tag_list()) {
// $taglist = get_the_tag_list('<span class="post-meta-tags"> '.__('Schlagworte', 'fau').': ',', ','</span>');
// }
}

if ($showfooter) {
Expand Down
2 changes: 1 addition & 1 deletion style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8fc0df0

Please sign in to comment.