Thursday, February 22, 2018

Publish Wordpress Posts Within a Specific Date Range


If you are okay not having an interface, the Display Posts Shortcode Plugin has parameters you can put into your shortcode to get posts from a certain date range.

date_query_before Specify the before argument for a date query. More info on Date Queries. Default: empty Example: [display-posts date_query_before="2015-12-31" date_query_after="2015-01-01"]

date_query_after Specify the after argument for a date query. More info on Date Queries. Default: empty Example: [display-posts date_query_before="2015-12-31" date_query_after="2015-01-01"]

Display Posts Shortcode (Available Parameters) — Support — WordPress.com

When paired with category/taxonomy parameter, this can be powerful to get archived posts that need to be displayed by date or their specific category for content/structural reasons.

taxonomy, tax_term, and tax_operator
Use these parameters to do advanced taxonomy queries. Use ‘taxonomy’ for the taxonomy you’d like to query, ‘tax_term’ for the term slug (or terms) you’d like to include, and ‘operator’ to change how the query uses those terms (most likely this field will not be needed).
Default: ‘taxonomy’ = empty , ‘tax_term’ = empty , ‘tax_operator’ = ‘IN’
Example: [display-posts taxonomy="color" tax_term="blue, green"]

If you want to display your posts with a the image thumbnail, and have it look better, you'll need to add some custom CSS to float the image.

And to separate the spacing between the posts with DIV wrappers (instead of OL or LI that add bullets), you'll need to add margin for:
.listing-item {margin-bottom: 2em;}

Posts by Date Range with a Plugin Visual Interface


WP Posts Master — WordPress Plugins
This plugin offers a visual interface and many options for getting Wordpress posts with specific filters.  However, only the Pro edition offers date filtering: "Filter Posts by custom dates. You can decide Start & End Date"
The Pro Edition is $28 on the Evato Marketplace

No comments:

Post a Comment

Only comments in English will be considered. Thank you!