Support » Plugins » [Plugin: A Year Before] How to write the function, parameters for A Year Before

  • 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>
    <?php if (function_exists('ayb_posts')) { ayb_posts("year=1&before=<li>&after=</li>&showdate=0&range=14&notfound=");
    ayb_posts("year=10&before=<li>&after=</li>&showdate=0&range=14&notfound="); } ?>

    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.

  • The topic ‘[Plugin: A Year Before] How to write the function, parameters for A Year Before’ is closed to new replies.