WordPress.org

Support

Support » Plugins and Hacks » plugin to change blog description based on date?

plugin to change blog description based on date?

  • Anyone know of a plugin that would allow me to change the blog description based on the day of the week? (rather its Monday, tue, wed, thurs, fri, sat or sunday)

    or could this be designed fairly easy?

    thanks

Viewing 15 replies - 1 through 15 (of 17 total)
  • <?php
    function daydesc() {
    $daydesc['Mon'] = 'Description for Monday';
    $daydesc['Tue'] = 'Description for Tuesday';
    /* etc: just finish the $daydesc['3-letter-day'] = 'description' info */
    if(!get_option('daydesc')) {
    add_option('daydesc', date('l'));
    update_option('blogdescription', $daydesc[date('l')]);
    } else {
    $stored_day = get_option('daydesc');
    $current_day = date('l');
    if($stored_day != $current_day) {
    update_option('daydesc', $current_day);
    update_option('blogdescription', $daydesc[$current_day]);
    }
    }
    }
    add_action('init', 'daydesc')
    ?>

    Don’t even know if it parses actually but look up the plugin headers on the codex, add them above the code, upload, activate and try it out.

    Hoo…. that would make a nifty widget, firas! Could be expanded to do months, seasons, holidays – wow…. cool!

    yeah thats what I was thinking too vkaryl

    I just had no idea how to write a plugin, how to even start for that matter, I’ve never done one before. I know PHP but thats about it.

    Well, me either, but I’m twitching around with the widget thing so I guess I’ll figure it out eventually. Thanks firas!

    vkaryl, at your pleasure! I haven’t looked into the widgets thing. They seem a bit scary. I guess I’ll gather the guts to figure out what on earth they are this weekend.

    Well, actually…. I’ve played around with various “self made functions”, and succeeded in making viable widgets out of them. Both sidebars on P O V are run with widgets for the most part.

    So if you get stuck, email me (vkaryl_at_bytehaven_dot_com) and we’ll discuss….

    well, I don’t care about widgets, as I don’t have the widget system on my blog anyway (and don’t care to, mainly because I’m scared that it will slow the loading time of my blog down more then it already is)

    I just wanted to know how to write a simple plugin to do it is all. with a screen in the options admin menu for it so options can be customized, which is a bit beyond my scope. I’m not a programmer by any means.

    I mean, that bit of code at the top there, I don’t even know where it goes, in my theme? a new file under plugins? or what? writing plugins is beyond my scope of understanding, and you shouldn’t have to be a PHP programmer to install a wordpress blog and add in some plugins is my point.

    Widgets don’t slow stuff down…. adding plugins is dirt-simple…. figuring out how to program a plugin isn’t easy but do-able eventually….

    The “bit of code” goes into a file produced by a vanilla text editor like notepad2. Then you need to find the correct plugin headers (probably using codex, dunno – never looked…. maybe you can extrapolate from other plugin files), add at the top, and save as dailydesc.php.

    Upload to the plugins folder, and if you did the headers right, it should show up to be activated. Activate and see what happens.

    I tried, and it doesn’t work 🙁

    and yes widgets do slow things down. so do enough plugins as I’m finding out the hard way 🙂 My blog now already takes 22 seconds to do a single page load, thats 20x slower then ordinary PHP files, and 20x slower then my simple machines forum.. alot of it is because I have like 20 plugins installed and it slows the page load time way down, to the point where I have been recieving complaints about it.. I can deal with it now, but I don’t want to add a widget system for that reason, I don’t want even more complaints then I’m already getting 🙂

    besides, not all my plugins come with widget support. the majority of ’em don’t

    Have you tried wp-cache? Yep, another plugin, but can sure make a difference.

    Ummmmm. I’ve got 43 plugins installed on my main blog. The page loads in about 7 seconds. Widgets – it’s also the one with widgets.

    It’s not the plugins/widgets….

    bubazoo, “it doesn’t work” as in, it doesn’t show up under plugins, you activate it and nothing happens, something else? You filled in the $daydesc array right? This is really trivial, nothing to pull your hair out over.

    oh I’m not pulling my hair out over it, its no big deal right now 🙂

    I don’t know, I was thinking the problem could be with one of my plugins. I’ve got the lightbox2 thing installed, and that flash image viewer thingy, and I’m thinking one of those could be causing the page to load slowly. I just don’t know if all my plugins will work with widgets or not and am too lazy to mess with it right now 🙂 hehe

    as for the original question, I’ll work on it more tomorrow, maybe something will come to me in my sleep. lol

    thanks

    Ah…. well, both flash and lightbox will crap your site sometimes.

    Let us know when you get “unlazy”.

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘plugin to change blog description based on date?’ is closed to new replies.