How to create a "new" badge in listing hive

Hi guys,

I would like to install a “new”-badge in my listing hive theme, displaying on ads which are <=60 days. I have tried this one:

function anzeigen_neu_badge( $content ) {
if ( is_singular(‘listing’) && get_the_time(‘U’) > strtotime(‘-60 days’) ) {
$content = 'NEU ’ . $content;
}
return $content;
}
add_filter( ‘the_content’, ‘anzeigen_neu_badge’ );

function anzeigen_neu_badge_css() {
echo ‘.neu-badge { background-color: #ff0000; color: #fff; padding: 5px; border-radius: 4px; font-size: 12px; }’;
}
add_action( ‘wp_head’, ‘anzeigen_neu_badge_css’ );

by using snippets, but doesn’t work.

Anyone an idea how to fix this issue?

Thanks in advance!
Sebastian

Hi,

Sorry, there’s no simple code snippet for this, it would require a custom implementation. If customizations beyond the available features are required for your site, please consider hiring someone for custom work https://fvrr.co/32e7LvY

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.