Create and display an excerpt from an ACF field

On a current project I'm creating a page of post listings but the clients blog posts do not use the standard content editor, instead an ACF field was used for blog post content.
When displaying this content we can pull the whole field, or none.. but no excerpt option is available!

Below is a method of pulling the content and using built in WordPress functionality to trim and present the newly trimmed excerpt:

Fading the screen when a hyperlink is clicked

We've been tasked with fading the screen when a menu item has been clicked and JQuery is the way forward!
In the below instance the class 'fading-menu' was added to the WordPress menu items that needed the fade effect (via 'Appearance' > ' Menus' (after showing classes via the screen options on the top right)).

We didn't just link any and all menu items as one URL is to a download file, no use in fading the screen for that!

This method does have its flaws, clicking the back button on your browser may result in returning to a faded out screen.
Enhancements to follow?

Format any phone number into an international URL

A lot of the time a phone number is entered into an ACF text field which needs to be clickable. Formatting the entire phone number would remove the pretty syntax the user likes to add, yet if it is not formatted the number often wouldn't work well when added in an anchor tag.

For this reason we are stripping the added information to use in a link behind the scenes, while still keeping the number nice and pretty on the front end for the user.
In the below example we are formatting UK phone numbers. You would need to replace the +44 country code for whichever is required.

© 2021 - FreshLondon