Do not ask question here, use support forum, any comments here will be ignore and deleted.
This plugin was inspired by “On this day” in Wikipedia’s home page. It can list posts which have same calendar date as today’s or as specific post’s.
Please check this demo blog post out.
Please download this plugin source in WordPress Extend, files are not provided in this project space.
!OnThisDay to wp-content/plugins (NOT directory on-this-day). You will have something like /wp-content/plugins/OnThisDay/OnThisDay.php.OTDList() to sidebar, or main post loop.This section will tell you, do you need to upgrade and anything you have to pay attention while upgrading.
$targetPost. You can only customize HTML using settings in Options page.From version 0.5, OTD allows you to remove all settings for OTD as well as deactivation of OTD.
!OnThisDay from plugins.There are three ways to use this plugin.
Go to Presentation/Widgets, drag widget “On this day” from Available Widgets, then drop it onto Sidebar.
It results like (in default theme)
Note:
You can check these two options under General Options in OTD Options page:
If you enable them, then the “On this day…” list will be appended right after post content.
OTDList()You can call OTDList() to get the list where you want to show. If you call this function within posts loop, then it will return posts which have same calendar date as current post.
<?php while (have_posts()) : the_post(); ?>
[...]
<div class="post-onthisday">
<h2>On this day...</h2>
<?php OTDList(); ?>
</div>
[...]
<?php endwhile;?>
in index.php of your template. You only need to take care the title of this list, then call OTDList(). In this mode, it uses templates in Single post mode Options or Multi-posts mode Options
sidebar.php,
<div class="sidebar-item-content">
<?php OTDList(); ?>
</div>
This use template of Widget Options. This results posts which have same calendar date as today. If visitor is reading a single post or page and Lists same calendar date posts to the post in single post mode of Widget Options is checked, then OTD plugin will list same calendar date posts as current post or page.
You can use On %date:jS of F%... instead of On this day.... You will get something like 28th of October....
You should not use heading tags(h1, h2,...) embracing title of widget.
If you need OTD list within a div block, you can use <div class="onthisday"><h3>On this day...</h3> as title and [snip] %search% </div> as block.
You can call `OTDList()` to list.
function OTDList($targetPost=null){
Check Exclude current year’s post in General Options. This option also applies on pages if Include pages checked.
You can turn this feature on under option page(it is activated by default). Once you turn it on, there will be a search form appended after the list.
User can select Month, Day of Month and Year in any possible combinations, include the first blank option in each part. The blank option means unspecific month, day of month, or year.
GetDateSearchForm() like
<?php echo GetDateSearchForm(); ?>
to get the search form only.
<form class="dateSearchForm" id="dateSearchForm-<?php echo rand(); ?>">
<div class="dateSearchForm">
<select class="dateSearchMonth" name="dateSearchMonth">
<option></option>
<option></option>
<option></option>
</select>
<select class="dateSearchDay" name="dateSearchDay">
<option></option>
<option></option>
<option></option>
</select>
<select class="dateSearchYear" name="dateSearchYear">
<option></option>
<option></option>
<option></option>
</select>
<input class="dateSearchButton" type="button" value="»" onclick="searchDate(this.form)"/>
</div>
</form>
You can define those styles into your stylesheet.
<?php /* If this is a category archive */ if (is_category()) { ?>
<h2 class="pagetitle">Archive for the ‘<?php single_cat_title(); ?>’ Category</h2>
<?php /* If this is a daily archive */ } elseif (is_day()) { ?>
<h2 class="pagetitle">Archive for <?php the_time('F jS, Y'); ?></h2>
<?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
<h2 class="pagetitle">Archive for <?php the_time('F, Y'); ?></h2>
<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
<h2 class="pagetitle">Archive for <?php the_time('Y'); ?></h2>
<?php /* If this is an author archive */ } elseif (is_author()) { ?>
<h2 class="pagetitle">Author Archive</h2>
<?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
<h2 class="pagetitle">Blog Archives</h2>
Usually these are in archive.php theme template file, like Default Theme 1.6.
You may modify it to be:
<?php /* If this is a category archive */ if ( is_category() ) { ?>
<h2 class="pagetitle">Archive for the ‘<?php single_cat_title(); ?>’ Category</h2>
<?php /* If this is a date archive */ } elseif ( is_date() ) { ?>
<h2 class="pagetitle">Archive for <?php echo dateArchiveTitle(); ?> </h2>
<?php /* If this is an author archive */ } elseif ( is_author() ) { ?>
<h2 class="pagetitle">Author Archive</h2>
<?php /* If this is a paged archive */ } elseif ( isset($_GET['paged'] ) && !empty($_GET['paged'])) { ?>
<h2 class="pagetitle">Blog Archives</h2>
<?php } ?>
The parts of daily, monthly and yearly archives have been removed, and replaced with a much simpler code:
<?php /* If this is a date archive */ } elseif ( is_date() ) { ?>
<h2 class="pagetitle">Archive for <?php echo dateArchiveTitle(); ?> </h2>
OnThisDay.php provides a function named dateArchiveTitle(), it will decide an appropriate date archive title, e.g.
2nd day of July in every year
in 2007
July in every year
but might it be possible to use strftime() to format the date?
It doesn't work. I installed and nothing shows in the widget. Fix it!
... how to display "Within 7 Dates in Previous Years" ?
Thanks a lot!