Custom conditional I wrote for my theme (mostly to kick some widgets and ads from newer posts), works nicely:
function is_old_post( $days = 14 ) {
if( !is_single() )
return false;
$id = get_the_ID();
$date = get_post_field( 'post_date', $id );
if( strtotime( $date ) < strtotime( "-{$days} days" ) )
return true;
return false;
}
Related Posts:
- WordPress plugin to publish to multiple remote WordPress blogs
- WordPress prompt checklist before publish?
- simple wp_insert_post example
- Retrieving and Storing Images Linked from Other Domains on Local Server?
- What Can I Use To Add A Custom Button Between Publish button and Move To Trash?
- WP_Query with the “offset” argument
- Stopping People Viewing Draft Posts
- How can I create custom button in post.php
- Calling Different Custom Post Timestamps in a table
- WordPress : using AJAX to get posts & Sidebar Content to an external application
- Specific colours for wordpress author ids
- Troubles about insering a POST with a SQL query, post_status
- Prevent WordPress from automatically installing a new theme each year
- Can we use one WordPress installation for multiple databases, domains and content directories
- Setting Custom Sort Order of Posts within a Category
- When adding a custom REST endpoint, where do you put the endpoint function, and where do you put the function registration call?
- WordPress objects class reference
- Customizing gallery shortcode in 3.5
- modify all posts of a category to “no comments allowed”
- How do you add pages on a staging server, and then move them over to production
- Any Hook Called When Post Becomes Published?
- Automatically wrap post image in div
- adding a custom css class to post
- Theme Twenty Fifteen: Customize Color Scheme Customizer
- How to handle security on a wordpress site? [closed]
- display order of connections
- Is it possible to set default values for custom fields in a custom post type while my plugin is being activated?
- WordPress Template not affecting the working, keeps defaulting to the index.php template
- Custom Widget form function common elements
- Display page content AFTER a loop of posts
- how to replace embedded “full” sized images within a post with the “large” ones
- Downgrade user from role that allows post creation
- apply filters only to specific post listing without check the url parameters
- Reinstall WordPress Without Losing Data
- Paginate Author’s Post List on Custom Author Page (ANOTHER THEORY)
- WP Northwind for Theme Development?
- list/consult Taxonomy only for the respective author/creator in dashbboard
- View Private Published Page with URL Code (no login required)
- How to check if site is created by wordpress? [duplicate]
- Enabling Additional CSS / custom-css
- Modify Gallery Output to render differently on a PAGE and a POST
- How to Call a static page in WordPress
- Add google org chart to wordpress page
- I’m using add_meta_box() but want to include TinyMCE editor *and* Media Uploads for each box
- Create custom dashboard for Multisite admins
- The function can not create a table on MariaDB server
- Child theme .css files are not overriding their parent .css files
- Highlight comments of all the site authors
- Set Title from Custom Template
- For a specific theme, how do I build a list of all the possible theme modification names?
- Editing the default page to show all posts, rather than most recent ones
- Allow guests to use WP Customizer but disable save button
- Add a custom meta box in the post options that loads some html code in the header
- Static posts page with home.php
- Custom posts in different columns style
- Can I add/replace the WordPress image in the Dashboard
- Post thumbnails not working in my new install of WP 3.1 with Twenty Ten theme
- Add content in between of foreach
- How to insert a writing panel between the title and the page content?
- Switch between WordPress websites easy for an end user
- Show custom message/info for authors in add/edit post page
- Using setup_postdata() with multi-dimensional array
- How to print Array values of custom Fields Meta?
- Customizer JS API get value of customizer field
- Hide content and functions from specific user roles
- Translating (WooCommerce) placeholder text
- Woocommerce custom archive page custom content and shortcode
- Page flickers in customization mode
- We are facing this error in header unable to understand the issue
- When is the wp-settings-[time] cookie generated?
- Get All Results From Other Users That Share The Same Custom User Meta As Current User
- Can we set a redirection with dynamic content in url?
- How to remove (…) from the post tilte on homepage?
- How can I setup a development environment which auto refresh page when code have changed [closed]
- How Can I add show_post_count in get_archives_link?
- Trouble with custom login page
- I want to use a product thumbnail completely different than the product image
- How can I edit the WordPress menu link to allow fb: instead of http
- Fixed bottom menu on mobile doesn’t work on search included in Child Theme of Storefront
- Change Dashboard menu position?
- Get site ID from attachment url?
- admin aoolbar add_node() and pulling in my post slug
- Dev and prod on the same database- dev version active for IOS
- How to delete/customize imported demo content from a theme or add my own?
- duplicate featured image functionality in custom meta box
- How to automatically pull an information from a form field onto an other page?
- How to create a custom menu for specific user
- Custom Form Input not saving to Database
- How to create 2 preview button in a post?
- Move text from the side of image to below image [closed]
- One Post with different content, depending on a Page
- Custom terms in custom category taxonomy
- Customize TinyMCE Buttons
- Setting Custom WordPress “Posts page” AS “Front page”
- Make a custom URL and link to custom Template
- How to show only the date, the title and a little “summary” of my WordPress post in my custom theme?
- How to delete unnecessary custom post types in the UI
- Instead of Custom CSS Theme CSS is loading
- How can add custom commands in post-new.php in wordpress
- Post interior margin in twenty eleven theme