How can I add a bubble that says "new content" to all posts within the last week? I have looked at all available solutions but they only appear to be for menu items.

thanks in advance.

<?php if( date('U') - get_the_time('U', $post->ID) < 24*60*60 ) : ?>
<div class="bubble"><?php _e('NEW', 'mytheme_name'); ?></div>
<?php endif; ?>

the above one will show NEW div for each post posted in 24 hours. You can simply add anywhere in your posts loop.

You can use 7 * 24 * 60 * 60 to make it weekly. More info about php time is here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.