WSUWP Content Syndicate
WSUWP Content Syndicate is a suite of WordPress plugins that for retrieving and displaying content from throughout Washington State University. This is the preferred method for displaying content throughout the platform and work continues to expand its usefulness.
It provides the following shortcodes:
[wsuwp_json]for displaying posts;
[wsuwp_events]for displaying events; and
[wsuwp_people]for displaying people.
It also provides support for pulling content based on WSU’s university taxonomies.
The shortcodes leverage the WP API for retrieving content and offer attributes for adjusting how the content is displayed.
There is a set of attributes shared between the three shortcodes for determining how they function. Each shortcode also supports additional attributes that are covered in their respective sections.
The attributes common to all WSUWP Content Syndicate shortcodes are as follows:
output– The HTML structure of each feed item. Each shortcode provides different output values.
host– The URL of a site on the platform from which to pull content.
count– A number value of items to display. Defaults to the number provided by the host, which is usually 10.
date_format– Accepts arguments similar to those accepted by WordPress in other contexts for modifying the date format.
offset– A number value from which to start displaying the feed items.
cache_bust– A number value. Used for breaking cache immediately.
university_category– A comma separated list of university category slugs.
university_organization– A comma separated list of university organization slugs.
university_location– A comma separated list of university location slugs.
category– A comma separated list of category slugs.
tag– A comma separated list of tag slugs.
Examples for how to use these attributes are included in the
[wsuwp_json] section below.
When writing any shortcodes, it’s important to ensure that attribute values are wrapped in straight quotes rather than curly quotes, and that the shortcode does not contain any HTML markup. Otherwise, the shortcode will not work as intended, if at all.
The most common use of the
[wsuwp_json] shortcode is to display recent news items from news.wsu.edu:
host attribute can be used to pull items from a specific site. To display the 10 most recent items from Carson College of Business, the following would work:
[wsuwp_json host="business.wsu.edu" count="10" output="headlines"]
output formats are available as well. We’ve tried to provide a good default HTML structure for each, but are happy to listen to suggestions for improvements.
- Headlines only:
- Item excerpts:
- Full posts:
- JSON object:
To combine posts from an outside source with local results for a site, the
local_count attribute can be used. For example,
[wsuwp_json count="10" local_count="5" output="headlines" host="news.wsu.edu"] will pull in 10 total items as headlines using both the current site and news.wsu.edu to populate the list based on publish date.
It is also possible to offset a list of items so that the most recent aren’t included in a feed. This has been used with success to show one item with an excerpt display and the rest as headlines. For example,
[wsuwp_json count="1" output="excerpts"] and
[wsuwp_json count="4" offset="1" output="headlines"] together would display as such:
WSU Everett Chancellor Pitre appointed to State Board of Education
Seattle native Paul Pitre, has served in higher education administration roles for more than 30 years. His appointed term begins immediately.Read Story
Taxonomies will also work as part of the shortcode. Depending on what is supported on the news site, results can be retrieved with filters for University Category, Site Category, or Tag.
[wsuwp_json count="5" university_category="agriculture" output="headlines"]
[wsuwp_json count="5" site_category="local-news" output="headlines"]
[wsuwp_json count="5" tag="blue" output="headlines"]
[wsuwp_json] shortcode also supports attributes for creating complex taxonomy queries. Support for these attributes will hopefully be extend to the other two attributes soon.
allif retrieved content should match all of the provided university category slugs. Defaults to match any.
allif retrieved content should match all of the provided organization slugs. Defaults to match any.
allif retrieved content should match all of the provided location slugs. Defaults to match any.
allif retrieved content should match all of the provided category slugs. Defaults to match any.
allif retrieved content should match all of the provided tag slugs. Defaults to match any.
anyif retrieved content should match any one of the provided taxonomy rules. Defaults to match all of the provided taxonomy rules.
As an example,
[wsuwp_json output="headlines" ="taco,burrito"] will pull a list of headlines for posts that are assigned either the category “taco” or the category “burrito”.
category_match attribute changes this behavior.
[wsuwp_json output="headlines" category="taco,burrito" category_match="all"] will pull a list of headlines for posts that are assigned both the “taco” and “burrito” categories.
Multiple taxonomies work in a similar way.
[wsuwp_json output="headlines" category="taco,burrito" univeristy_location="wsu-pullman"] will pull a list of headlines for posts that are assigned the location of “wsu-pullman” and either the category “taco” or the category “burrito”.
taxonomy_match attribute changes this behavior.
[wsuwp_json output="headlines" category="taco,burrito" univeristy_location="wsu-pullman" taxonomy_match="any"] will pull a list of headlines for posts that are assigned the location of “wsu-pullman” or have either the category “taco” or “burrito” assigned.
date_format attribute can be used in the event that a different date format is desired. The shortcode will accept arguments similar to those accepted by WordPress in other contexts, like so
[wsuwp_json output="excerpts" date_format="F j, Y"].
All uses of the shortcode are automatically cached for 10 minutes to reduce server load on both sides of the request for new items. The
cache_bust attribute is available if something needs to be changed immediately or fresh results have just been posted. Changing this is only necessary if no other attribute is changed.
[wsuwp_json output="headlines" cache_bust="1"]
[wsuwp_json output="headlines" cache_bust="2"]
While the functionality of each shortcode is exactly the same, setting the cache_bust attribute to 2 clears the cache.
The common use for the
[wsuwp_events] shortcode is to display events from events.wsu.edu:
- Aug 18 Faculty Art Exhibit: Avantika Bawa’s Coliseum collection
- Aug 21 Fine Arts Faculty Exhibition Self•ish: Doug Gast, Joe Hedges, and Io Palmer
- Sep 15 Outdoor Photo Contest
- Sep 17 “2 Weeks of Pullman” Encourages Coug Health fund donations
- Sep 18 Memento: Selected Works from the Elwood Collections
- Sep 18 Crow’s Shadow: Institute of the Arts at 25
- Sep 23 Student Organization Leadership Involvement Day
- Sep 23 WSU Planetarium: Solar System Sensation
- Sep 24 Free workshop to support health equity
- Sep 24 Voiland School of Chemical Engineering and Bioengineering Graduate Seminar Series
Events can be filtered by the all the common taxonomies, with one caveat. If no
host is specified – that is, you’re pulling events from events.wsu.edu – the
category attribute will have no effect. However, you can filter events from events.wsu.edu by Type by using the
type attribute, which accepts a comma separated list of type slugs.
The events shortcode also supports the following additional attributes:
period– Set to
pastto display the most recent past events.
featured– set to
trueto display the featured events from the events.wsu.edu home page (works only if no host is specified).
And in addition to the
headlines value for the
output attribute, the events shortcode accepts
excerpts_legacy for including the excerpt along with the headline information for each event.
The common use for the
[wsuwp_people] shortcode is to display profiles from people.wsu.edu.
The people shortcode supports the following additional attributes:
classification– A classification slug to retrieve people by.
display_fields– A comma separated list of fields to display for each profile. Defaults to
photo,name,title,office,email. Additional fields include
filters– A comma separated list of filtering options. Allowed values include
categoryvalue combines terms from university categories and site categories. Labels for each filter option can be adjusted using the attributes below:
category_filter_label– Defaults to
Filter by category.
classification_filter_label– Defaults to
Filter by classification.
location_filter_label– Defaults to
Filter by location.
organization_filter_label– Defaults to
Filter by organization.
search_filter_label– Defaults to
Type to search.
tag_filter_label– Defaults to
Filter by tag.
photo_size– Specify the size of the photo to display for each profile. Defaults to
thumbnail. Other allowed values include
website_link_text– Link text to display for the
websitefield when it is being output. Defaults to
nid– Accepts a WSU Network ID to display an individual profile.
heading_tag– HTML tag to use for the profile title. Defaults to
link– Links the the name and photo of each profile to a full profile view (see the example usage below). Accepts either
has-bioto add links only to those profiles with a biography, or
yes. This attribute only works when used in conjunction with the
profile_page_url– Link to a page on your site that is configured to display full profiles (see the example usage below).
The people shortcode can be used to display full profiles on your site by doing the following:
- Set up a page for displaying full profiles by including only
[wsuwp_people output="profile"]as the page content.
display_fieldsattribute can also be set up to configure how the full profiles will be displayed.
- Use the URL of the above page as the value for the
profile_page_urlattribute, and set one of the accepted values for the
[wsuwp_people profile_page_url="https://hd.wsu.edu/people/people-profiles/" link="has-bio"].