WordPress.org

Ready to get started?Download WordPress

Forums

The Events Calendar
[resolved] Displaying Current month & year on Events Calendar (10 posts)

  1. Kevin Kwok
    Member
    Posted 1 year ago #

    Love the plugin, however I cannot figure out how to display the current month and year as plain text. I know by default it shows the current month and year currently in view via a drop down. I want to figure out what I need to do to get this in plain text. Does anyone know how to do this?

    http://wordpress.org/extend/plugins/the-events-calendar/

  2. Kevin Kwok
    Member
    Posted 1 year ago #

    I found this via their website:

    Current Month Date
    tribe_get_displayed_month()
    Returns a formatted date string of the currently displayed month (in "jump to month" mode)

    Returns
    string
    More Info
    return: Name of the displayed month.
    since: 2.0

    SO I ended up putting this in my grid.php file (found at plugin folder/views/gridview.php)

    <h1><?php tribe_get_displayed_month(); ?></h1>

    NOTHING appears...

  3. Kevin Kwok
    Member
    Posted 1 year ago #

    HAR HAR. i missed echo

    <h1><?php echo tribe_get_displayed_month(); ?></h1>

    and like the wordpress forums intended, users will talk to themselves and figure it out. Thanks for the stage and time wordpress. Once again I shamed myself. Hope this helps someone in the future.

  4. kshapiro
    Member
    Posted 1 year ago #

    Thank you very much for posting what you found! This helped me tremendously!

  5. roblagatta
    Modern Tribe Support
    Plugin Author

    Posted 1 year ago #

    Big thanks here, Kevin Kwok! We really appreciate you taking the time to come back and post this, and as you can see, at least kshapiro found it valuable. Cheers...if you're ever interested in going PRO, shoot us an email (pro /a/ tri.be) and we'll see if we've got any open coupon codes we can hook you up with.

  6. sqrlstogy
    Member
    Posted 1 year ago #

    Did you figure out how to get the year to display? I have the month but the year is giving me some issues.

  7. kshapiro
    Member
    Posted 1 year ago #

    sqrlstogy:
    I just used <?php echo tribe_get_displayed_month(); ?> and it echos the month and the year.

  8. jonahcoyote
    Member
    Posted 1 year ago #

    Thanks for the follow up and solution kshapiro!

  9. j3ddesign
    Member
    Posted 1 year ago #

    Jumping in on this a little bit late.
    I had the exact same problem however managed to sort it out using the details here and also a bit of googling.

    For future browsers, the code I came up with is:

    <?php
    $curryear = substr(tribe_get_displayed_month(), -4);
    $currmonth = substr(tribe_get_displayed_month(), -0, -4);
    
    echo $curryear;
    echo $currmonth;
    ?>
  10. roblagatta
    Modern Tribe Support
    Plugin Author

    Posted 11 months ago #

    Greatly appreciate the follow-up here, j3ddesign, in case anyone else finds themselves in a similar position down the road. Cheers :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic