Using WordPress shortcodes

One of the best things about Psygraph is that it integrates with WordPress.  The data is stored on a WordPress server, and it can be accessed on your blog pages by using WordPress codes called shortcodes.  Here is a quick summary of the pg_link, pg_page, and pg_event shortcodes.  Many of these shortcodes are used on the user overview pages: see the WordPress screenshots for pictures of the results.

[pg_link linktext="text" format="kml"]

This shortcode generates a link to a file.

The linktext parameter defined the text that the user sees, and can be any string.

The format parameter is a file format.  The following formats are currently supported:

  • CSV (comma separated values)
  • KML (a map file)
  • HTML (a page for display on the web)
  • ICS (a format used for calendar interoperability)
[pg_page page="client"]

This shortcode renders a page of content.  The following pages can be specified:

  • client: the Psygraph web client directly on the WordPress page. The client can also be accessed outside of WordPress at http://psygraph.com/webclient.
  • audio: Display an audio control that can play all of the user’s audio notes and memos.
  • input: Render a form which can be used to upload events to the Psygraph plugin.
[pg_events]

If you wish to display Psygraph events directly on your blog, use the [pg_events] shortcode.  Set the display option to generate maps or graphs.  It can be used with the optional parameters described below to limit the number of events which are displayed.  For example, [pg__events start=”1972-08-22″] will display all of the events since August 22, 1972.

browserEventList

You can set the “display” option to one of the following options to display your data on a map or graph instead of in an HTML table.

  • map: Render a map directly on the page which consists of the accumulated geographic data.
  • graph2D: Display data in a 2D graph.
  • graph3D: Display data in a 3D graph.

These shortcodes are used to create the user overview pages: see  http://psygraph.com/pg_beta for a live example.

 

Optional Parameters

When you generate links to files or list of events, you may wish to restrict which events are selected.  The following optional parameters may be used for both the pg_link and pg_events tags.

  • max=”42″

This parameter lets you select the maximum number of events to be displayed.  It is a numerical parameter which must be greater than zero.

  • start=”2015-04-26″
  • end=”2016-08-22 14:15:00″

These parameters allow you to specify date ranges for the events.  The format of both of these parameters is specified in years-months-days hours:minutes:seconds.  The start parameter above references April 4, 2015, and does not specify the time (0:0:0 is assumed).  The duration parameter references August 22, 2016 at 2:15 PM.

  • id=”123″

The ID parameter lets you specify the id of a particular event.

  • page=”timer”

The page parameter lets you restrict your query to events generated by a particular page.

  • category=”exercise”

The category parameter lets you restrict your query to events in a particular category.

  • type=”interval”

The type parameter lets your restrict your query to events of a particular type.  For example, the stopwatch page generates both “interval” (which correspond to a start and stop time) and “reset” events (which correspond to pressing the reset button).