WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: A Year Before] How to write the function, parameters for A Year Before (1 post)

  1. Dgold
    Member
    Posted 5 years ago #

    If you wish to use this plugin, or any plugin, without the widgets, and instead you insert the code directly into your theme files -- then I have found it's best to always use the IF THEN code, that checks to see if you have the plugin activated. If the plugin isn't activated then it overlooks this area instead of breaking your theme!

    That said, here is the way I did the IF THEN for the plugin, A Year Ago.

    You can do it different ways, but this is working alright for me.

    <h2>Some Anniversary Posts From Years Past</h2>
    <ul>
    <?php if (function_exists('ayb_posts')) { ayb_posts("year=1&before=<li>&after=</li>&showdate=0&range=14&notfound=");
    ayb_posts("year=2&before=<li>&after=</li>&showdate=0&range=14&notfound=");
    ayb_posts("year=3&before=<li>&after=</li>&showdate=0&range=14&notfound=");
    ayb_posts("year=4&before=<li>&after=</li>&showdate=0&range=14&notfound=");
    ayb_posts("year=5&before=<li>&after=</li>&showdate=0&range=14&notfound=");
    ayb_posts("year=6&before=<li>&after=</li>&showdate=0&range=14&notfound=");
    ayb_posts("year=7&before=<li>&after=</li>&showdate=0&range=14&notfound=");
    ayb_posts("year=8&before=<li>&after=</li>&showdate=0&range=14&notfound=");
    ayb_posts("year=9&before=<li>&after=</li>&showdate=0&range=14&notfound=");
    ayb_posts("year=10&before=<li>&after=</li>&showdate=0&range=14&notfound="); } ?>
    </ul>

    I'm showing this for 2 reasons. First is the IF THEN statement. Secondly, this plugin with the above parameters: shows 1 headline from my blog from "the current week" for each of the last 10 years. Actually it searches broader than 1 week, it covers 14 days range from the anniversary of today, 1 year ago... 2 years ago.... 10 years ago.

    It's a fun plugin, give it a try, if you have a backlog of posts from years of the past.

    http://wordpress.org/extend/plugins/a-year-before/

Topic Closed

This topic has been closed to new replies.

About this Topic