<?php
$timelimit=1 * 86400; //days * seconds per day
$post_age = date('U') - get_post_time('U');
if ($post_age < $timelimit) {
echo 'this post is within my time limits '; //DO SOMETHING
}
?>
Related Posts:
- How to Loop within a Loop (Display Children and then Grandchildren)
- WP_Query vs get_posts
- Query Custom Meta Value with Increment
- Is `query_posts` really slower than secondary query?
- Are there any scenarios where the query_posts may be used?
- 3 Posts in Loop, Show Stickies First
- How to display posts by vote count and if no value continue with latest posts with no votes?
- Include current post into loop
- Should I reset $wp_query?
- Query posts only with actual text content (not including shortcode or images)
- Ordering Posts by parent category, name ascending
- Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?
- How to fix pagination for custom loops?
- Should we trust the post globals?
- Remove the Homepage Query
- Order posts by ID in the given order
- Get the number of posts from the current page results
- Identify which loop you are hooking into; primary or secondary?
- WordPress Number of Posts Not Changing With posts_per_page
- Multiple posts with one loop iteration
- Transient not working for custom loops
- Post Loop not Returning Permalink
- Transient pagination not working properly
- If No Search Results, Show Posts from Alternate Search Query
- Query for posts in 2 taxonomies
- Pass the same object to multiple widgets in a template with one query
- How do you query wordpress posts using a math formula between multiple meta field values?
- Page navigation doesn’t show when query category
- How would I get 1 latest post from a query for 5 posts?
- 2 loops on page – one with orderby rand second orderby date
- Undefined WP_Query::has_posts()?
- Create ONE callback for all page templates, post filter queries + paginated pages, triggering pagination via AJAX
- Loop posts only excluding first post
- Exclude posts with empty post_content in wp_query
- How to get to a specific position in wp_query?
- Slow WP_query due to nested wp_query. Need Suggestions
- Five posts from a category in footer
- Query posts if meta key starts with
- How to exclude latest x posts from a paginated query?
- Order by empty custom field
- Some doubts about how the main query and the custom query works in this custom theme?
- How can I paginate this?
- Different Ways to Query Custom Post Types?
- How to fix pagination for custom loops?
- Query Page Content From Theme Options?
- posts_per_page option limits the number of Gallery items
- Exclude first post (sticky or not) from the loop using query_posts()
- How do I rewrite this loop as a new WP_Query style-loop?
- How can I improve the performance of this query_posts loop?
- Loop inside query
- How to provide meta_key array to wp_query?
- How to add div blocks after certain set of post
- Adding div after every two post on main loop! Why will first post not get counted?
- Filter post query to only show direct children of category
- get_posts output always same post
- Exclude taxonomy term from all loops, but having it on widget
- Pagination on category.php and tag.php not working
- How to make posts unqueryable/unpublish posts where ACF relationship field is an unpublished post? [closed]
- WP_Query: Show 10 posts in date order, first three random
- postsperpage value not being applied
- query_posts clarification needed
- Why doesn’t my WP Meta Query return any results?
- Paginate pages with dynamic query
- Performance concerns: index.php vs taxonomy-$taxonomy.php
- Determine if ID is page or post and query the ID
- Custom template for password protected page
- Custom Post Type Query W/Category Dropdown
- Filter products on category AND tag
- Why does my WP_Query pagination on a custom page.php only loads the homepage?
- How do I stop the same post showing multiple times in a archive?
- Get posts that match defined arrays of tags
- Custom Query with Sticky Posts
- I need query_posts() to order results first by a meta value and then by post ID
- WP_Query & Duplicate entries
- WordPress For Loop Prints Unwanted Extra Paragraph Element
- Query posts and display all dates in repeater field in chronological order
- query_posts() doesn’t seem to be called in my page
- Some doubts about how the main query and the custom query works in this custom theme?
- Alternative layout the loop
- Show posts by tags excluding current post
- Sort / Filter Queries
- Is it possible to add query parameters on the archive page?
- Optimising specific Query with ACF meta objects
- Loop through multiple custom fields with increasing number
- Advanced Post Display/Pagination/Ordering
- How to organize a WP_Query’s list of posts by category and display category title?
- How to fix pagination for custom loops?
- meta_query dates from an array
- Query Posts From Multiple Post Types
- get_posts and wp_autop (remove filter)
- How to fix pagination for custom loops?
- query_posts ignores the argument
- Query Posts by date range with fixed beginning and end
- Twitter bootstrap carousel multiple items in carousel
- show posts from one category with comments only
- Multiple loop for “featured” items returns wrong posts
- How to exclude certain portfolios from a loop
- Limitless amount of posts in custom archive page
- Multiple loop with pagination in same page
- Show number of posts AND number on current page (cannot make it work)