Examples of how the people directory can look
We have made several updates to how you can now create galleries of people on your site. Creating a listing of people is accomplished with a shortcode and there are options available via shortcode attributes.
The simplest way to create a listing of all the directory entries (people) on the site is to just use the shortcode with no attributes:
This will create a tabular view of everyone on your site
With the table view, you can sort and filter and it supports pagination.
To show division names on the table view
People can be categorized into divisions. If you want to show this field on the table, add the attribute “show_division”. This will add a column for division in the tabular view and will allow the user to search/sort by it. This has no affect when the display type is set to “gallery”
To switch the view to a gallery view
To change the view to a gallery view, use the shortcode attribute displaytype:
[upd_people_directory displaytype="gallery"] (NOTE: The default view is a table view, so if you want a table view, you don’t need to include this attribute)
This will change the view to a gallery view with thumbnails and other information
To limit the view to people only from a certain division
People can be categorized into different divisions (think post categories). To only show people from a certain division, set that attribute in the shortcode:
NOTE: The “divisions” attribute must be the SLUG of a division (not the title). You can enter multiple divisions here separated by a comma and it will display all people from those divisions:
[upd_people_directory divisions="network-services, systems"]
To show pagination on the gallery view
By default, pagination is turned off on the gallery view. You can enable it with the shortcode “show_pagination”
[upd_people_directory divisions="network-services" displaytype="gallery" show_pagination="true"]
NOTE: Pagination is turned on by default in the tabular view. This attribute has no affect when the view is set to tabular view.
You can control the number of items that show per page by setting the shortcode attribute: items_per_page
[upd_people_directory divisions="network-services" displaytype="gallery" show_pagination="true" items_per_page="2"]
You can override the styles for the pagination in your theme.
Making the gallery view have multiple columns
Instead of having the gallery profile be a single column, you can set it to layout in multiple columns across the page. You can’t control how many columns…the layout will just make as many columns as there space available.
To turn on multi-column, add the multi-column attribute to the shortcode:
[upd_people_directory displaytype="gallery" show_pagination="true" multi_column="true" items_per_page="3"]
To show an arbitrary list of people
You can also show a gallery containing an arbitrary list of people by setting the postids parameter. You can set this to a list of people ids.
[upd_people_directory divisions="network-services" displaytype="gallery" postids="2076,1981,1970" show_pagination="true" items_per_page="2"]
NOTE: This is an inclusive query, so it will show people that are in the divisions parameter OR people who’s post id matches any in the postid parameter list.
To show people at the top of a listing
By default, all views are listed in alphabetical order. If there are people, such as a department head, who need to show up at the top of a listing, you can select that when editing that person. Check the “Override Sort Order” checkbox and then set the “Sort Order” parameter. The “Sort Order” number is used when there are multiple people who need to show at the top. This will sort them in that order.
Setting the “Sort Order” without checking the “Override Sort Order” checkbox has no affect.
To link the profile to an external profile
You can create a person on your site, but link their profile page to another profile page. To do this, create the person and set the “Page Links To…” field to “A custom URL” and enter the URL into the text field below
This is so you can display only someone’s name and contact information on your site, but maintain all their main profile data in another site.
NOTE: This will not pull in any information from the other site. Any contact information you want to display, you will need to enter it manually.
To not have the profile linked to a profile page
If you want to create a profile, but not have it linked to an individual profile page (or an external profile), check the “Don’t Link profile” checkbox when creating the profile. It will display in gallery and tabular views with the contact information you have entered, but will not link to an individual profile page (or an external URL)
Overriding shortcode output
There are 3 templates that control the output of this plugin. They are located in the “upd-templates” folder in the plugin. The 2 shortcode templates are in a folder called “shortcode-templates”.
- upd-gallery-view.php. This template controls the markup for the gallery view
- upd-table-view.php. This template controls the markup for the table view
In the root of the folder, the template called “upd-single-directory.php” which controls the markup for a single profile view.
To override any (or all) of these, create a folder called “upd-templates” in your theme folder. Copy the templates you want to override from the “upd-templates” folder in the plugin to the folder in your theme.