Skip to main content Skip to navigation
Web Communication WSUWP Content Syndicate

WSUWP Content Syndicate

Plugin overview

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.

Contents:

Common Attributes

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.

^ Back to table of contents

[wsuwp_json] – Retrieve and display posts

The most common use of the [wsuwp_json] shortcode is to display recent news items from news.wsu.edu:

The 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"]

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] (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, 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:

  • Closeups of Kamie Ethridge and Kyle Smith. Tournament-bound

    WSU Men’s and Women’s Basketball teams achieve unrivaled success ahead of momentous post-season play.

    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"]

The [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.

  • university_category_match – Specify all if retrieved content should match all of the provided university category slugs. Defaults to match any.
  • university_organization_match – Specify all if retrieved content should match all of the provided organization slugs. Defaults to match any.
  • university_location_match – Specify all if retrieved content should match all of the provided location slugs. Defaults to match any.
  • category_match – Specify all if retrieved content should match all of the provided category slugs. Defaults to match any.
  • tag_match – Specify all if retrieved content should match all of the provided tag slugs. Defaults to match any.
  • taxonomy_match – Specify any if 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”.

Adding the 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”.

Adding the 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.

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

^ Back to table of contents

[wsuwp_events] – Retrieve and display events

The common use for the [wsuwp_events] shortcode is to display events from events.wsu.edu:

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 past to display the most recent past events.
  • featured – set to true to 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.

^ Back to table of contents

[wsuwp_people] – Retrieve and display WSU People Profiles

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 degreeaddressphonebiobio-unitbio-university, and website.
  • filters – A comma separated list of filtering options. Allowed values include searchlocationorganizationclassificationtag, and category. The category value 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 medium and large.
  • website_link_text – Link text to display for the website field when it is being output. Defaults to Website.
  • nid – Accepts a WSU Network ID to display an individual profile.
  • heading_tag – HTML tag to use for the profile title. Defaults to h2.
  • link – Links the the name and photo of each profile to a full profile view (see the example usage below). Accepts either has-bio to add links only to those profiles with a biography, or yes.  This attribute only works when used in conjunction with the host or profile_page_url attribute.
  • 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.
    • The display_fields attribute 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_url attribute, and set one of the accepted values for the link attribute, i.e. [wsuwp_people profile_page_url="https://hd.wsu.edu/people/people-profiles/" link="has-bio"].

^ Back to table of contents