<?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.
Related Posts:
- What is the use of to_ping and pinged column?
- Add custom Attachment Display Setting for images
- Rewriting post slug before post save
- Prevent Authors from viewing each others Posts
- Removing filter dropdown in posts table (in this case Yoast SEO)
- Export WordPress Posts and Meta Information in CSV format
- Posting From Apple Aperture?
- How to know if get_posts() failed?
- Show related posts by category but ignore one category
- Replacing all attachment links in post with media file link
- Change the default number of posts to show on mobile version
- Post content being duplicated by the_content();
- How can I pass $post object to ‘save_post’ add_action?
- eBooks download website, page or post?
- Add few specific post ids to wp_query
- Disable REST API for a user ROLE
- Can I hide a specific post from latest posts page?
- Insert posts in two tables
- How To Keep Posts from Being Displayed Two or More Times on My Homepage? [closed]
- custom wordpress post loop – hide iframe content
- Latest 5 posts (custom post type), each post different CSS
- Add scripts on custom post add/edit pages Not Working
- Add custom field automatically (add_post_meta) with value based on number of words of article
- How to access featured image?
- previewing my posts on static page?
- How to retrieve the postID in a “image_send_to_editor” hook function?
- Post revisions disappeared (for some posts)
- Replace ‘published on date’ with ‘modified on date’ on Posts
- How to display category from recent posts?
- Display featured products by category
- Best way to assign post position in a news site homepage? (no categories, no sticky posts)
- How do I restart my loop with get_next_post()?
- “Duplicate” Posts Appearing Since 3.1.2 Update
- Rename “post” to “article” throughout the admin back end [duplicate]
- Change post order random through out the entire WordPress
- Set size for attachments
- How to render arbitrary post without displaying it [closed]
- Adding an image to a non existing post
- How can I add content to a post that only shows in single-post mode?
- Excluding posts not working
- How to Get Posts, Including Private Ones?
- Find the Post ID of a post from another website
- (solved) getting post author’s user role
- Block editors annoying warnings
- Disable auto-save and post revisions from inside a theme or plugin
- Refresh problem post is duplicated when page is submitted after page reload
- Migrate posts from category and sub-category via SQL
- Force fill all fields when creating a new post
- register_post_type permalink
- Display recent posts from portfolio
- WordPress display posts category in loop
- How to get post with slug and exclude categories
- How can I set a maximum allowed post size and number of posts submitted?
- Adding post date will not insert new post
- How to make related post order by random?
- WordPress displays post on subcategory only
- Update field in database for users
- Only show featured image on exerpt and exclude images in post
- Get timestamp of latest post in C#
- Prevent 404 of Author pages without posts
- Categories Listing and Highlighting current category item
- In admin panel, use a form to create a post?
- How to get the post id (of the parent custom custom type) in a loop inside a widget?
- WP_Query get posts in custom database table [duplicate]
- How to save template data into wp_post table (post_content column)
- WP query taxonomy optimization
- How to set a Post’s default visibility to ‘Private’ in Gutenberg?
- Sticky Post Doesn’t always work
- Single Post Gallery Using Shortcode
- How to show only homepage in google results instead of privacy, contact pages
- My posts are getting to Auto draft when I try to Publish
- Moving Gutenberg content from one website to another (block media ids wrong?)
- Get post by two meta key but order by one of them
- How do you update post date (year only) in a separate custom field?
- Is it possible to make a custom post that adds multiple pages?
- Creating a link to the first post in a category
- sometimes on saving a post as draft, it says Access Denied You don’t have permission to access “mywebsite.com/wp-admin/post.php”
- How do I change the post title’s link on the posts page?
- How do I make it so that new posts within a certain category go into a certain page?
- WordPress text field in array problem
- List Authors For Current Category
- Get query result according to merged array
- cleaning out posts that don’t exist anymore but links are still there
- Custom URL Structure for posts with subcategories
- Possible to display X number of authors posts from another WordPress site?
- some posts being displayed as pages
- Assign specific ads to specific categories/posts
- Reading Setting Not Working for Number of Posts
- 404 for some custom taxonomy not ALL taxonomy
- Add tags to post before it’s created
- can’t post immediately
- Where are my posts linked to? I keep getting a Not Found Error, and I have no single.php page
- List posts that are in the same category as the current post title
- save_post not working
- Password-protected Posts lead to 404 Error
- Multiple blog “feeds” in a single blog each with distinctly styled post pages
- How to get pagination working with “Pending” Posts
- How to show all Posts Image, Title and 3 line description on main page?
- Post’s arent displaying
- Show with echo if a post has two or more categories