You can alter the default slug from ‘announcement’ to something more custom, or to your language of choice by using the provided filter timeline-express-slug.

As an example, if you had a timeline of ‘Events‘ and wanted to change the slug for all of your announcements from ‘/announcement/’ to ‘/event/’, you could use the following function.

Note: The following code snippet will be added to your active themes functions.php file. If you are unsure of how to access or edit that file, you can use a third party WordPress plugin to add the code snippet from the WordPress dashboard. One that we highly recommend is My Custom Functions.
/**
 * Customize the Timeline Express slug
 *
 * Change '/announcement/' to '/event/'
 */
function timeline_express_change_announcement_slug( $slug ) {
    $slug = 'event';
    return $slug;
}
add_filter('timeline-express-slug', 'timeline_express_change_announcement_slug' );

If you wanted to translate the slug, or change it to something else, just change ‘event’ in the code snippet above to something of your choosing (eg: $slug = 'anuncio';).

404’s? Refresh the Permalinks!

After you have added the above code to your themes functions.php file, you must refresh the permalinks. Or in other words, re-save the settings on the permalinks page. If you don’t you’ll be unable to access any existing announcements and you’ll run into a 404 error.

To refresh the permalink settings, from the dashboard, you’ll want to head into Settings > Permalinks. Don’t worry about changing any of the settings, just click save at the bottom of the page. This will trigger an update of the permalink structure in the database and will fix any 404’s you might run into after changing or altering the announcement slug.

You should now be free to navigate the Timeline Express timeline, 404 free.

3 Comments

  1. Hello,

    When I use the code above, it successfully changes the slug from ‘announcement’ to ‘event’.

    However, when the ‘read more’ visible option is selected within the Time Express settings, and then clicked on each individual announcement, the link does not work. (I had to remove the code from functions.php to get ‘read more’ to work.

    It seems as though additional code is needed to accommodate the ‘read more’ option if the slug is changed. What do you suggest?

    Thank you.

    – Debbie

    Reply
    • Hi Debbie,

      This is normal behavior for WordPress. If you leave the code inside of your functions.php file, all you need to do is ‘refresh’ the permalinks. Or in other words, head in to the permalinks settings page (Settings > Permalinks) and click on ‘Save’ at the bottom of the page. This will refresh the permalink structure in the database, and the new slug will then be reflected in the URL to each individual announcement. This happens when you change the slug of an existing post type, and requires a simple refresh of the settings. Once you re-save the settings things should start working as you expect them too. Please feel free to contact us or post back here if you are still having issues after giving the above recommendation a try.

      I went ahead and updated the documentation above, to add a section about refreshing the permalinks once you update the announcement slugs. Feel free to read through and follow along for a quick solution to the issue.

      Thanks!
      Evan

      Reply

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.