Macro Kit

Macro Kit provides several functions that can be imported into your front-end templates for use in Craft CMS.

  • abbrStateName - Given a full US state name this returns the abbreviated name of that state.
  • dateRange - Given two dates within the same month, this returns a formatted date range.
  • fullStateName - Given an abbreviated US state this returns the full state name.
  • linkToIf - Given a condition this wraps a block within a link if the condition is met.
  • ordinalNum - Given a number this returns the number with its ordinal suffix: 1 => 1st
  • randomString - Generates a random string of numbers and letters given a specific length.
  • summarize - Takes a block of HTML text, strips the tags and trims it to match a given length in characters.
  • stripPhone - Takes a formatted phone number string and strips all non-numeric values to return only the numbers.


Package Name

To install this plugin, search for its package name on the Plugin Store and click “Install”.


  • Version 1.2.0
  • Last Update 3/6/2019
  • Active Installs 63
  • Compatibility Craft 3
  • License MIT
  • Categories Templating, Utilities

Report an issue