• Resolved aaronlp

    (@aaronlp)


    Hi,
    Wondering a couple of things:
    1. Is it possible to just show a single month? Looking to code the current month or next month into a widget which will sit in the sidebar.
    2. Is it possible to have the full calendar show starting from the current month. As we are in November, my 2012 calendar shows a heap of wasted months at the top and the current months that anyone would care about are at the bottom. I’d like to show Nov 2012 – Oct 2013 as my 12 months instead of Jan 2012 – Dec 2012.

    cheers
    Aaron

    http://wordpress.org/extend/plugins/availability/

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Steve

    (@stvwhtly)

    Hi Aaron,

    Here are a few answers to your questions:

    1. It is possible to display just a single (current) month, however this currently can only be achieved via CSS and isn’t a perfect solution.

    2. It is not current possible / easy to hide months in the past, although you are not the only person to request this functionality.

    Sorry that I haven’t been too helpful here, but struggling for time at the moment.

    Thread Starter aaronlp

    (@aaronlp)

    Thanks for your reply Steve. I’m actually a php developer so happy to give it a shot to build this functionality into the plugin if this is acceptable? (I’m New to wordpress – not sure on the etiquette)

    Aaron

    Plugin Author Steve

    (@stvwhtly)

    That’s fine. I’m sure it wouldn’t be too difficult to make the changes.

    If you get around to it, I will happily accept changes / svn diff files, and once scanned over include them in a future release.

    Hi guys,
    Sorry if I jump on a ‘Resolved’ post but I was gonna ask the same Aaron’s questions. A widget or a shortcode to embed in a text widget, and starting the calendar from the current month would improve a lot the plugin’s frontend usability. Personally I’d just need to hide past months because, in my case, nobody needs to check availability for days in the past.
    Thanks!

    Plugin Author Steve

    (@stvwhtly)

    Hi,

    No worries on the “Hijack” 🙂

    There is a todo list, which is getting slightly longer ever time I look at it, however I intend to dedicate some time towards the end of this week.

    If I can fit in your requests they will appear in the next update.

    Thanks for your feedback.

    – Steve

    I also have no interest in showing historical months. Here’s what I did to start a calendar on the current month.

    In the calebndar.php file find the line that reads:
    $current_year = get_the_time( ‘Y’ );
    near the top of the file (around line 10).

    Immediately after that line I added the following:

    $start_month = 1;
    if($current_year == $year){
    $start_month = date(‘m’);
    }

    Then a few lines down, find the line that reads:
    <?php for ( $month = 1; $month <= 12; $month++ ) : ?>

    Change this to:

    <?php for ( $month = $start_month; $month <= 12; $month++ ) : ?>

    Job done.

    I can now add
    [availability calendar=”studioflat1″ year=”2013″]
    [availability calendar=”studioflat1″ year=”2014″]
    to my page and get what’s left of this year plus the whole of next year shown.
    On January the 1st of 2014, nothing will show for 2013 without having to edit the shortcode on the page at all.

    Hope this helps.

    Hi John,
    Thanks for your code. This was exactly what I was looking for!

    I encountered a small error: the booked class was not working for July and I discovered that you need to pass the month number without a leading zero: using date(‘n’) instead of date(‘m’)
    So the line added should be:

    $start_month = 1;
    if($current_year == $year){
    $start_month = date('n');
    }

    Thanks again for sharing your code.

    Just dropped in to add my thanks to johnwebman

    This is great, just what I needed

    Hey guys thanks so much for all of this awesome fix for showing calendar at current month. I’ve added the codes and my calendar still shows jan 2013 until now. Any thoughts?
    http://ourvacationhomes.ca/?page_id=44

    Thank you!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘start calendar on current month’ is closed to new replies.