Let's assume we have a post type employee
and some categories. We want to get all employees, who are assigned to a specific category to add them via a shortcode. The shortcode should have two attributes: category
and layout
. The category
attribute should accept a comma-separated list of category slugs or IDs. The layout
attribute should define the output layout: grid
or slider
.
Here is an example of how to create a shortcode to list employees by category:
/**
* Listing of employees by category
*
* Example: [employee category="Physiotherapie" layout="grid"]
* - layout="grid": Displays the employees in a grid (default)