WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] Year in permalink url (17 posts)

  1. Beee
    Member
    Posted 9 months ago #

    I'ld like to have the year in the permalink, because almost all events will be happening again in 2014 and I don't want them to be called "event-slug-2".

    I found this post http://wordpress.org/support/topic/plugin-events-manager-date-in-the-permalink?replies=11 but I don't know how to modify it so it only will output events/yyyy/event-slug.

    I think only these 2 lines need changing, but I don't know what the correct syntax is. Can anyone help ?

    $start_date = $object->event_start_date;
    $start_date = str_replace('-', '/', $start_date);

    http://wordpress.org/extend/plugins/events-manager/

  2. scharc
    Member
    Posted 9 months ago #

    i am looking for the same thing ... not with the year but to generate a more friedly looking permalink for repeating events...

    i found this http://wordpress.org/support/topic/method-to-update-post_title-and-post_name-for-custom-post?replies=8 which explains how to hook into the post-object before it is commited to the db ...

    there you could just change the post_name (which is the slug and the permalink) and add some extra meta data from the events object to it

  3. scharc
    Member
    Posted 9 months ago #

    maybe this will help you:

    http://pastebin.com/J5bVChfa

    its not perfect but maybe a way for you...

    i needed the location and the date in the slug

    the-80s-party-5 -> location-slug-y-m-d-the-80s-party

    when you change the location of the event, you have to update twice ... something to do when the hooks are fired and the data is saved to mySQL...

  4. Beee
    Member
    Posted 9 months ago #

    will check it, thanks....

  5. Beee
    Member
    Posted 9 months ago #

    I'm wondering what the plugin guys (marcus or angelo_nwl) have to say about this. If a feature like this will be included.

  6. scharc
    Member
    Posted 9 months ago #

    check this thread: http://wordpress.org/support/topic/created-a-custom-slug-function

    i posted an update of the function

    i think it would be awesome if this kind of function would find its way into the plugin, so that anybody could take controll over the slug

    it would be a good way for SEO as well

  7. Beee
    Member
    Posted 9 months ago #

    is an output like this possible ?
    events/yyyy/event-slug

    and did you fix the 'having to update twice' ?

  8. scharc
    Member
    Posted 9 months ago #

    the update twice bug is gone!

    but! if you want to have slashes in the url its not just a custom slug... you have to write some rewrite urls and put in some handlers for them ... bla bla...

    short version: nope ;)

    it is a SLUG generator not a path generator...

  9. Beee
    Member
    Posted 9 months ago #

    Hmmm... well the year isn't over... Still have about 6 months left to search...

    But is it as simple as creating a new rewrite rule for custom post type event ? Because 'all I wanna do' is insert the publication year.

  10. caimin_nwl
    NetWebLogic Support
    Posted 9 months ago #

    Beee, I'm wondering if you couldn't use scharc's code to make the event slug event-name-2014?

    It's not exactly what you wanted, but doesn't that solve your problem?

  11. Beee
    Member
    Posted 9 months ago #

    I could, but I could do than manually myself. I don't need a script for that. I still prefer events/year/slug sorry

  12. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 9 months ago #

    we won't takle this ourselves at the moment, WP ideally should implement this - http://core.trac.wordpress.org/ticket/21374

  13. Beee
    Member
    Posted 9 months ago #

    then let's hope they do before dec 31 ;)

  14. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 9 months ago #

    i wouldn't hold my breath :)

  15. Beee
    Member
    Posted 9 months ago #

    It's not the best way, but I think that I'll rename all slugs from /slug/ to /2013-slug/ by hand, so I can use the 'normal' names next year.

  16. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 9 months ago #

    that'd probably be the 'best' way.

    you could even hook into WP's slug generation and manually add that when saving event post types. no real difference between a dash and a slash as far as SEs are concerned I think.

  17. Beee
    Member
    Posted 9 months ago #

    true but a slash looks better imo. I like nice links without additions of numbers (unless it's an event that happens several times per year ;) )

    that's why I'm doing it to the archive. don't care about those, but do want to save them...

    Thanks all for your input, marking it closed now.

Reply

You must log in to post.

About this Plugin

About this Topic