Banner for Random Posts Within Date Range Widget
Widget that displays the title(w/ link), date(optional), and excerpt(optional) of random posts within a selected date range. Wordpress Tutorial
Noted That:
  • To install correctly this random-posts-within-date-range-widget.zip .
  • Fisrt Download the random-posts-within-date-range-widget.zip to your computer
  • Extract/Open random-posts-within-date-range-widget.zip to Your Computer.
  • Then, Find readme.txt file inside random-posts-within-date-range-widget.zip and Open readme.txt .
  • Now, Read the Requirements of this plugin. Which Wordpress Version and PHP Version are required to run this Plugin in Your Wordpress Site.
  • Then, Follow the Tips Below.
Start the Tips:

Step-1 : Download " random-posts-within-date-range-widget.zip " to Your Local Computer.

Step-2 : Then, Login to your " yourdomain.com/wp-admin " Dashboard.

Login to Wordpress Random Posts Within Date Range Widget

Step-3 : Then, Click on " Plugins " + " Add New " from left Side Menu of Dashboard.

Go to Plugin Install Random Posts Within Date Range Widget

Step-4 : Now, Click on " Upload Plugin " button.

Click Upload Button Random Posts Within Date Range Widget

Step-5 : Now, Browse " random-posts-within-date-range-widget.zip " Downloaded plugin from your computer, Where you downloaded " random-posts-within-date-range-widget.zip " According to Step – 1 Above then, click on " Install Now "

Upload Plugin Random Posts Within Date Range Widget

Step-6 : Now, Click on " Active Plugin "

Activate Random Posts Within Date Range Widget

Step-7 : Then, See left Side Menu. " Random Posts Within Date Range Widget " folder is added on left Side Menu. Now, Click on " Random Posts Within Date Range Widget " folder.

Noted that: If you do not see " Random Posts Within Date Range Widget " folder on left Side Menu then, see at left Side Menu " Settings " or " Tools ".

Step-8 : Now you configure yourself oR Watch video tutorial below about Random Posts Within Date Range Widget Configurations and Settings or How to work " Random Posts Within Date Range Widget " in your WordPress site.

oR

After Activated Plugin According to Step-6 then,

  1. Go to " Plugins " + " Installed Plugin " from Wordpress Admin Panel Leftside Menu.
  2. or Direct go to: https://yourdomain/wp-admin/plugins.php
  3. Then, Find " Random Posts Within Date Range Widget " Activated Plugin from Plugin List.
  4. Then, Click on " Settings " from Plugin that is Random Posts Within Date Range Widget
  5. Now, Edit/Add/Config the setting and Click on " Save Changes " button,
WP Plugin Setting



Guide
  1. Download, unzip, and upload the random-posts-within-date-range-widget folder along with all its files to the /wp-content/plugins/ directory.
  2. Activate the plugin through the ‘Plugins’ menu in WordPress.
  3. Go to the ‘Widgets’ page under ‘Appearance’ and drag an instance of the widget into the selected sidebar.
  4. Edit settings to meet desired effect.

A few important notes:
* 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.)
* Likewise, if you click the “Use time relative to current date” box, it will override the above date settings.
* 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.
* 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.

The CSS of the widget can be edited much like any other HTML element. The structure is as follows:


  • TITLE

    .random-post-list {font-family:Arial, sans-serif;} .random-post-element { margin:5px;} .random-post-title {font-size:14px;} .random-post-title a {color:#000;} .random-post-title a:hover {text-decoration:none;} .random-post-date {font-size:12px; color:#333;} .random-post-excerpt p{font-size:12px;}
  • The functionality of this plugin can be accessed outside of the widget with the use of this function:

    
    random_posts_within_date_range($settings)
    

    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.

    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):

    
    $settings['count']; //INTEGER - Number of posts to retrieve
    $settings['start_month']; //INTEGER - month of start date (1-12)
    $settings['start_day']; //INTEGER - day of start date (1-31 depending on # of days in month)
    $settings['start_year']; //INTEGER - year of start date (after 1970)
    $settings['no_end']; //BOOLEAN - TRUE to allow current date to always be end, FALSE to use below value as end date
    $settings['end_month']; //INTEGER - month of end date (1-12) (only used if 'no_end' is FALSE)
    $settings['end_day']; //INTEGER - day of end date (1-31 depending on # of days in month) (only used if 'no_end' is FALSE)
    $settings['end_year']; //INTEGER - year of end date (after 1970) (only used if 'no_end' is FALSE)
    $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
    $settings['relative_months']; //INTEGER - number of months to go back to pull posts (only used if 'use_relative' is TRUE)
    $settings['relative_days']; //INTEGER - number of days to go back to pull posts (only used if 'use_relative' is TRUE)
    $settings['relative_years']; //INTEGER - number of years to go back to pull posts (only used if 'use_relative' is TRUE)
    $settings['use_category']; //BOOLEAN - TRUE to only grab posts from specific category, FALSE to select from all categories
    $settings['category']; //INTEGER - ID of category to pull posts from (only used if 'use_category' is TRUE)
    

    This can then be used as follows:

    
    
    have_posts() ){ $random_posts->
    the_post(); ?>
     


    Name