Skip to main content Skip to navigation

WSUWP Content Syndicate

Plugin overview

WSUWP Content Syndicate is a WordPress plugin to retrieve and display content from throughout Washington State University. This is the preferred method for displaying content throughout the platform and work continues to expand its usefulness.

Shortcodes are included to pull news items, events, and people.

[wsuwp_json] – Retrieve and display news items

The most common use of the [wsuwp_json] shortcode is to pull recent news items from news.wsu.edu and display them as headlines on another page:

[wsuwp_json count="5" output="headlines"]

If no host is specified, news.wsu.edu will be used as the default. In the above shortcode, the 5 most recent items from news.wsu.edu will be displayed as headlines wherever the shortcode is entered.

Here’s the output of the above example:

A different host can also be specified. To display the 10 most recent items from Carson College of Business, the following would work:

[wsuwp_json host="business.wsu.edu" count="5" output="headlines"]

Additional 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: [wsuwp_json output="headlines"]
  • Item excerpts: [wsuwp_json output="excerpts"]
  • Full posts: [wsuwp_json output="full"]
  • JSON object: [wsuwp_json]

Note in the examples below that count is not included as an attribute. Results for these will default to the number automatically provided by the host, which is usually 10 by default.

The option for a JSON object is provided so that results can be manipulated directly with JavaScript. With this option, no output will appear on the page itself.

To combine posts from an outside source with local results for a site, a local_count attribute can be provided.

[wsuwp_json count="10" local_count="5" output="headlines" host="news.wsu.edu"]

This 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.

[wsuwp_json count="1" output="excerpts"] [wsuwp_json count="4" offset="1" output="headlines"]

The combination of these two shortcodes would display as such:

  • Apply for summer research in bioenergy, health, bioplastics

    PULLMAN, Wash. – Deadlines are March 1, 3 and 10 for undergraduates to apply for three new Washington State University summer research programs that recently received grants from the National Science Foundation (NSF) and U.S. Department of Agriculture.

    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_slug="agriculture" output="headlines"] [wsuwp_json count="5" site_category_slug="local-news" output="headlines"] [wsuwp_json count="5" tag="blue" output="headlines"]

In the rare event that a different date format is required for either the excerpt or full view of a news item, the shortcode will accept arguments similar to those accepted by WordPress in other contexts.

[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. If something needs to be changed immediately or fresh results have just been posted, a cache busting attribute is available. 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.

[wsuwp_events] – Retrieve and display Events Calendar events

The common use for the [wsuwp_events] shortcode is to pull events from calendar.wsu.edu and display them as headlines on another page:

[wsuwp_events count="5"]

If no host is specified, calendar.wsu.edu is used as the default. In the above shortcode, the 5 most recent calendar events from calendar.wsu.edu will be displayed wherever the shortcode is entered.

Here’s the output of the above example:

Specifying a host will retrieve events from that site instead.

[wsuwp_events count="5" host="business.wsu.edu"]

The current shortcode does not support different output formats, though an excerpt and full view is planned for the future. Suggestions for extension to this shortcode are welcome.

Events can be filtered by Event Category, but not yet by University Category, Site Category, or tag. Support for additional taxonomies will be available in the future.

[wsuwp_events count="5" category="music"]

And as with the [wsuwp_json] shortcode documented above, [wsuwp_events] supports attributes for cache_bust and date_format.

[wsuwp_people] – Retrieve and display WSU People

Support for this shortcode is limited and we will continue to update documentation as it is improved.

The common use for the [wsuwp_people] shortcode is to pull people from people.wsu.edu and display basic profile information on another page:

[wsuwp_people count="1" university_organization_slug="university-communications"]

Here’s the output of the above example:

Jon Bickelhaupt
WEB DESIGNER
INFO TECH 2014
jbickelhaupt@wsu.edu

More to come!