WordPress.org

Ready to get started?Download WordPress

Forums

Availability Calendar
[resolved] start calendar on current month (11 posts)

  1. aaronlp
    Member
    Posted 1 year ago #

    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/

  2. Steve
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  3. aaronlp
    Member
    Posted 1 year ago #

    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

  4. Steve
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  5. lucabarbetti
    Member
    Posted 1 year ago #

    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!

  6. Steve
    Member
    Plugin Author

    Posted 1 year ago #

    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

  7. johnwebman
    Member
    Posted 1 year ago #

    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.

  8. vloot
    Member
    Posted 1 year ago #

    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.

  9. rosetrees
    Member
    Posted 1 year ago #

    Just dropped in to add my thanks to johnwebman

  10. pixelgnd
    Member
    Posted 11 months ago #

    This is great, just what I needed

  11. belboschi
    Member
    Posted 10 months ago #

    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!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.