{"id":9555,"date":"2010-06-24T22:06:30","date_gmt":"2010-06-24T22:06:30","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/random-posts-within-date-range-widget\/"},"modified":"2010-09-12T06:16:33","modified_gmt":"2010-09-12T06:16:33","slug":"random-posts-within-date-range-widget","status":"publish","type":"plugin","link":"https:\/\/sr.wordpress.org\/plugins\/random-posts-within-date-range-widget\/","author":1028755,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"1.2","stable_tag":"trunk","tested":"3.0.5","requires":"2.8.6","requires_php":"","requires_plugins":"","header_name":"Random Posts Within Date Range Widget","header_author":"Alex Chalupka","header_description":"","assets_banners_color":"","last_updated":"2010-09-12 06:16:33","external_support_url":"","external_repository_url":"","donate_link":"http:\/\/alexchalupka.com\/donate","header_plugin_uri":"http:\/\/alexchalupka.com\/projects\/wordpress\/random-posts-widget\/","header_author_uri":"http:\/\/alexchalupka.com\/","rating":0,"author_block_rating":0,"active_installs":40,"downloads":9494,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":[],"upgrade_notice":{"1.0":"<ul>\n<li>N\/A<\/li>\n<\/ul>","1.1":"<ul>\n<li>Relatively small upgrade, only necessary if you want to use random_posts_within_date_range() function or if you&#039;ve had problems with the formatting of the widget settings box.<\/li>\n<\/ul>","1.2":"<ul>\n<li>Another small fix. Upgrade only needed if you&#039;re using the widget to display post dates.<\/li>\n<\/ul>"},"ratings":{"1":0,"2":0,"3":0,"4":0,"5":0},"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.0","1.1","1.2"],"block_files":[],"assets_screenshots":{"screenshot-2.png":{"filename":"screenshot-2.png","revision":"1538973","resolution":"2","location":"plugin"},"screenshot-1.png":{"filename":"screenshot-1.png","revision":"1538973","resolution":"1","location":"plugin"}},"screenshots":{"1":"This is the widget settings box you'll see in your widget admin screen.","2":"An example of the plugin in action. Formatting\/style can be changed via CSS. Check the installation guide for details."},"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[610,1358,166,244,162],"plugin_category":[43,57],"plugin_contributors":[80690],"plugin_business_model":[],"class_list":["post-9555","plugin","type-plugin","status-publish","hentry","plugin_tags-categories","plugin_tags-date","plugin_tags-posts","plugin_tags-random","plugin_tags-widget","plugin_category-customization","plugin_category-taxonomy","plugin_contributors-lupka","plugin_committers-lupka"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/random-posts-within-date-range-widget.svg","icon_2x":false,"generated":true},"screenshots":[{"src":"https:\/\/ps.w.org\/random-posts-within-date-range-widget\/trunk\/screenshot-1.png?rev=1538973","caption":"This is the widget settings box you'll see in your widget admin screen."},{"src":"https:\/\/ps.w.org\/random-posts-within-date-range-widget\/trunk\/screenshot-2.png?rev=1538973","caption":"An example of the plugin in action. Formatting\/style can be changed via CSS. Check the installation guide for details."}],"raw_content":"<!--section=description-->\n<p>This plugin allows you to create a widget that will display the title\/date\/excerpt from random posts in a specified(or open-ended) date range. It can also be used outside of a widget to create custom loops of random posts within a date range. The following can be specified:<\/p>\n\n<ul>\n<li>Number of posts to display<\/li>\n<li>Whether or not to show dates<\/li>\n<li>Whether or not to show excerpts<\/li>\n<li>Excerpt length (number of words)<\/li>\n<li>Start date and End date of posts to randomize<\/li>\n<li>Whether or not to always use current date as end. (Allows you to include new posts without editing settings every day)<\/li>\n<li>Option to use relative time instead (To chose from random posts from last week, year, etc.)<\/li>\n<li>Category to choose posts from. (Example: Random posts from sports category in the past week. This is the original reason I needed a plugin like this. Comes in handy for the newspaper site I run.)<\/li>\n<\/ul>\n\n<p>Please contact me if you run into any issues, either via email (lupka31@gmail.com) or Twitter (http:\/\/twitter.com\/lupka)\nFor latest FAQs\/info visit: http:\/\/alexchalupka.com\/projects\/wordpress\/random-posts-widget\/<\/p>\n\n<!--section=installation-->\n<ol>\n<li>Download, unzip, and upload the <code>random-posts-within-date-range-widget<\/code> folder along with all its files to the <code>\/wp-content\/plugins\/<\/code> directory.<\/li>\n<li>Activate the plugin through the 'Plugins' menu in WordPress.<\/li>\n<li>Go to the 'Widgets' page under 'Appearance' and drag an instance of the widget into the selected sidebar.<\/li>\n<li>Edit settings to meet desired effect.<\/li>\n<\/ol>\n\n<p>A few important notes:\n*   If you click the \"Always use current date as end point\" box, it will override the \"End Date\" settings. (I had fancy JavaScript functions to validate\/disable these menus, but ran into issues when running multiple instances of the widget. It's on my to-do list for upcoming versions.)\n*   Likewise, if you click the \"Use time relative to current date\" box, it will override the above date settings.\n*   If the \"Show Excerpt\" box is checked and the post has a manual excerpt, WordPress will output the entire manual excerpt, regardless of what is entered in the \"Excerpt Length\" box. \n*   If you check the \"Show Excerpt\" box and leave the \"Excerpt Length\" box blank or with \"0\" entered, it will use the default 55 words.<\/p>\n\n<p>The CSS of the widget can be edited much like any other HTML element. The structure is as follows:<\/p>\n\n<pre><code>&lt;li class=\"random-post-element\"&gt; \n&lt;p class=\"random-post-title\"&gt;&lt;a href=\"#\"&gt;TITLE&lt;\/a&gt;&lt;\/p&gt; \n&lt;p class=\"random-post-date\"&gt;DATE&lt;\/p&gt; \n&lt;span class=\"random-post-excerpt&gt;EXCERPT&lt;\/span&gt;     \n&lt;\/li&gt;\n<\/code><\/pre>\n\n<p>Example CSS (used in screenshot):<\/p>\n\n<pre><code>.random-post-list {font-family:Arial, sans-serif;}\n.random-post-element { margin:5px;}         \n.random-post-title {font-size:14px;}\n.random-post-title a {color:#000;}\n.random-post-title a:hover {text-decoration:none;}\n.random-post-date {font-size:12px; color:#333;}\n.random-post-excerpt p{font-size:12px;}\n<\/code><\/pre>\n\n<p>The functionality of this plugin can be accessed outside of the widget with the use of this function:<\/p>\n\n<pre><code>random_posts_within_date_range($settings)\n<\/code><\/pre>\n\n<p>The function returns a post variable similar to that returned by WP_Query(). This allows you to use the_author(), the_content, etc. to create custom loops.<\/p>\n\n<p>These are the values accepted for the $settings array used for the function (Sorry, it's a little complex, hope to clean this up in the future):<\/p>\n\n<pre><code>$settings['count']; \/\/INTEGER - Number of posts to retrieve \n\n$settings['start_month']; \/\/INTEGER - month of start date (1-12) \n$settings['start_day']; \/\/INTEGER - day of start date (1-31 depending on # of days in month) \n$settings['start_year']; \/\/INTEGER - year of start date (after 1970) \n\n$settings['no_end']; \/\/BOOLEAN - TRUE to allow current date to always be end, FALSE to use below value as end date\n$settings['end_month']; \/\/INTEGER - month of end date (1-12) (only used if 'no_end' is FALSE)\n$settings['end_day']; \/\/INTEGER - day of end date (1-31 depending on # of days in month) (only used if 'no_end' is FALSE)\n$settings['end_year']; \/\/INTEGER - year of end date (after 1970) (only used if 'no_end' is FALSE)\n\n$settings['use_relative']; \/\/BOOLEAN - TRUE to use relative date (i.e. \"posts from the 5 days\"), this overrides the above end and start values, FALSE use start and end date values\n$settings['relative_months']; \/\/INTEGER - number of months to go back to pull posts (only used if 'use_relative' is TRUE)\n$settings['relative_days']; \/\/INTEGER - number of days to go back to pull posts (only used if 'use_relative' is TRUE)\n$settings['relative_years']; \/\/INTEGER - number of years to go back to pull posts (only used if 'use_relative' is TRUE)\n\n$settings['use_category']; \/\/BOOLEAN - TRUE to only grab posts from specific category, FALSE to select from all categories\n$settings['category']; \/\/INTEGER - ID of category to pull posts from (only used if 'use_category' is TRUE)\n<\/code><\/pre>\n\n<p>This can then be used as follows:<\/p>\n\n<pre><code>&lt;?php $random_posts = random_posts_within_date_range($settings); \n\nwhile ( $random_posts-&gt;have_posts() ){\n    $random_posts-&gt;the_post();  ?&gt;\n\n    &lt;p&gt;&lt;a href=\"&lt;?php the_permalink(); ?&gt;\" rel=\"bookmark\" title=\"Permanent link to &lt;?php the_title_attribute(); ?&gt;\"&gt;&lt;?php the_title(); ?&gt;&lt;\/a&gt;&lt;\/p&gt;\n    &lt;p&gt;&lt;?php the_time(\"F n, Y\"); ?&gt;&lt;\/p&gt;\n    &lt;p&gt;&lt;?php the_excerpt(); ?&gt;&lt;\/p&gt;              \n    &lt;\/li&gt;\n\n    &lt;?php } ?&gt;\n<\/code><\/pre>\n\n<!--section=faq-->\n<dl>\n<dt>Will you add xxx feature?<\/dt>\n<dd><p>I'm definitely up for adding some more features, but at the same time, I don't want to get away from the primary purpose of this widget. It's easy for this sort of thing to get out of control. No one likes bloated software.<\/p>\n\n<p>Ideas for new versions are included but not limited to:<\/p>\n\n<ul>\n<li>Support for thumbnails<\/li>\n<li>Ability to select which authors to choose.<\/li>\n<li>Custom CSS within widget settings box<\/li>\n<\/ul>\n\n<p>Let me know what features you'd like to see, and I'll consider adding them.<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>1.0<\/h4>\n\n<ul>\n<li>Initial version of the plugin<\/li>\n<\/ul>\n\n<h4>1.1<\/h4>\n\n<ul>\n<li>Adds ability to use random_posts_within_date_range() function to access functionality outide of widgets and create custom loops with random posts.<\/li>\n<li>Correction of small formatting problems with widget settings page in right-to-left languages.<\/li>\n<\/ul>\n\n<h4>1.1<\/h4>\n\n<ul>\n<li>Fixes small bug with post dates on the widget.<\/li>\n<\/ul>","raw_excerpt":"Widget that displays the title(w\/ link), date(optional), and excerpt(optional) of random posts within a selected date range.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/sr.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/9555","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sr.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/sr.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/sr.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=9555"}],"author":[{"embeddable":true,"href":"https:\/\/sr.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/lupka"}],"wp:attachment":[{"href":"https:\/\/sr.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=9555"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/sr.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=9555"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/sr.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=9555"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/sr.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=9555"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/sr.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=9555"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/sr.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=9555"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}