WordPress.org

Ready to get started?Download WordPress

Forums

All-in-One Event Calendar
[resolved] get_the_event_category()? (13 posts)

  1. urbanty
    Member
    Posted 2 years ago #

    Hi.

    on my global single.php template file I'm displaying the category of the post as part of the title.
    It looks like this:

    <?php
    $category = get_the_category();
    echo ' <a href="' . get_category_link($category[0]->cat_ID) . '" title="Alle Artikel in der Kategorie ' . $category[0]->name . '">' . $category[0]->name . ' →</a>';?>

    Since All in One Calendar is also using the single.php file for displaying a single event, I would like to have it show the event category's name and URL. Is there a way to do this?
    Right now, this part just stays empty.

    Many thanks in advance! :)

    http://wordpress.org/extend/plugins/all-in-one-event-calendar/

  2. urbanty
    Member
    Posted 2 years ago #

    Alternatively: Is there a way to re-route the single event pages to use a different template file? Something like single-calendar.php?

  3. nelra
    Member
    Posted 2 years ago #

    Hi,

    You can do a check on the current Post Type in single.php and then run different code/output depending if the post type is an event

  4. urbanty
    Member
    Posted 2 years ago #

    How does that work? :)

  5. Yani Iliev
    Member
    Posted 2 years ago #

    @urbanty

    Is there a way to re-route the single event pages to use a different template file?

    Yes. Since WP 3.0 this option is supported.
    Create a new file in your theme and name it single-ai1ec_event.php
    Copy the contents of single.php to single-ai1ec_event.php and start working on the design/code.

  6. urbanty
    Member
    Posted 2 years ago #

    Hi yani.iliev,

    that's great! Thanks a lot!

    One more thing though: In the event-single.php file in the directory
    /all-in-one-event-calendar/app/view/event-single.php
    I found something like

    <a class="ai1ec-button ai1ec-calendar-link" href="<?php echo $calendar_url ?>">
    					<?php _e( 'Back to Calendar »', AI1EC_PLUGIN_NAME ) ?>
    				</a>

    Is it possible to use stuff from this script in the single-ai1ec_event.php file?

    Many thanks! :)

  7. Yani Iliev
    Member
    Posted 2 years ago #

    @urbanty

    The content of all-in-one-event-calendar/app/view/event-single.php
    will be shown inside single-ai1ec_event.php
    If you copy something from event-single.php it will be basically shown twice on the page.

    If you need to change something, you will have to do it in event-single.php file.
    Use single-ai1ec_event.php to change the position of widgets or some other details that are not event related. For all event related changes, you will have to edit the plugin.

  8. urbanty
    Member
    Posted 2 years ago #

    Hm, okay. But then getting back to my original problem, how can I add to the single-ai1ec_event.php file e.g. the title and link of the current event's event-category?

  9. Yani Iliev
    Member
    Posted 2 years ago #

    @urbanty

    I was replying to this question:

    Alternatively: Is there a way to re-route the single event pages to use a different template file? Something like single-calendar.php?

    The answer to your initial question: http://pastebin.com/K9eBmDUJ

  10. urbanty
    Member
    Posted 2 years ago #

    Hey yani,

    thanks so much for your effort! Works perfectly! :)

  11. Yani Iliev
    Member
    Posted 2 years ago #

    You are welcome

  12. tarundeology
    Member
    Posted 2 years ago #

    Multi-day events only show the first day of the event in month view. For instance, if the event is from January 10 to January 15, the event only show in January 10. I did realise that it shows properly in the week view, but i think it is a lot better to show it in the month view since it is a default view. Users might think that the date where the event continues got no event. Is there a way to show multi-days event properly in month view. If it can be done quickly, can you please show me how? Thank you.

  13. Yani Iliev
    Member
    Posted 2 years ago #

    @tarundeology
    This topic is marked as resolved, you should follow this topic

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic