Hallo Zusammen,
ich versuche seit geraumer Zeit und mittlerweile verzeifelt mein Artisteer Theme anzupassen und ein Date-Badge wie dieses hier zu erstellen:
[ATTACH=CONFIG]7079[/ATTACH]
Die gewünschten Klassen sind bereits in mein style.css eingearbeitet.
Die Ausgabe des Wochentags funktioniert bereits, ich habe aber Probleme bei der Anzeige des
Datums (postDate) und Monats(postMonth). Es wird schlichtweg nicht ausgegeben.
Anbei mein aktuelles Skript (functions.php), ich würde mich freuen, wenn mir jemand diesbezüglich weiterhelfen könnte.
Vielen Dank vorab.
PHP
function theme_get_metadata_icons($icons = '', $class = '') {
global $post;
if (!is_string($icons) || theme_strlen($icons) == 0)
return;
$icons = explode(",", str_replace(' ', '', $icons));
if (!is_array($icons) || count($icons) == 0)
return;
$result = array();
for ($i = 0; $i < count($icons); $i++) {
$icon = $icons[$i];
switch ($icon) {
case 'date':
$result[] = '<span class="entryDate">' . sprintf(__('<span class="%1$s"><!--Published--></span>%2$s', THEME_NS),
'date',
sprintf(
'<span class="postDay" title="%1$s">%2$s</span>', esc_attr( get_the_time() ), get_the_date('l'),
'<span class="postDate" title="%1$s">%2$s</span>', get_the_date('d'),
'<span class="postMonth" title="%1$s">%2$s</span>', get_the_date('F')
)
) . '<br></span>';
break;
case 'author':
$result[] = '<span class="bistro-postauthoricon">' . sprintf(__('<span class="%1$s">By</span> %2$s', THEME_NS),
'author',
sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
get_author_posts_url( get_the_author_meta( 'ID' ) ),
sprintf( esc_attr(__( 'View all posts by %s', THEME_NS )), get_the_author() ),
get_the_author()
)
) . '</span>';
break;
case 'category':
$categories = get_the_category_list(', ');
if (theme_strlen($categories) == 0)
break;
$result[] = '<span class="bistro-postcategoryicon">' . sprintf(__('<span class="%1$s">Posted in</span> %2$s', THEME_NS), 'categories', get_the_category_list(', ')) . '</span>';
break;
case 'tag':
$tags_list = get_the_tag_list('', ', ');
if (!$tags_list)
break;
$result[] = '<span class="bistro-posttagicon">' . sprintf(__('<span class="%1$s">Tagged</span> %2$s', THEME_NS), 'tags', $tags_list) . '</span>';
break;
case 'comments':
if (!comments_open() || !theme_get_option('theme_allow_comments'))
break;
theme_ob_start();
comments_popup_link(__('Leave a comment', THEME_NS), __('1 Comment', THEME_NS), __('% Comments', THEME_NS));
$result[] = '<span class="bistro-postcommentsicon">' . theme_ob_get_clean() . '</span>';
break;
case 'edit':
if (!current_user_can('edit_post', $post->ID))
break;
theme_ob_start();
edit_post_link(__('Edit', THEME_NS), '');
$result[] = '<span class="bistro-postediticon">' . theme_ob_get_clean() . '</span>';
break;
}
}
$result = implode(theme_get_option('theme_metadata_separator'), $result);
if (theme_is_empty_html($result))
return;
return "<div class=\"bistro-post{$class}icons bistro-metadata-icons\">{$result}</div>";
}
Alles anzeigen
