Feed shortcode

RSS Feeds

You can pull an RSS feed by using the RSS Widget as described in the section: How to embed a news feed from RSS; however, this method will only allow you to place an RSS feed in the widget area of your site and the feed will be visible throughout the entire site (unless it's on the frontpage). This might not be what you want. No worries! You can use the feed shortcode to place an RSS feed exactly where you want it, on any page of your liking. You can either use the Section widget and type the feed shortcode in the Section widget, like so: [feed].

The shortcode has a number of parameter values:

  1. view=
    • list
    • rsswidget
    • blog
    • archive (does need excerpt_length to be set)
    • cal or calendar
    • events
    • listevents
    • upcoming (does not work with month parameter on RSS feed)
    • timeline
    • flickr (Flickr feeds are limited to the latest 20 images http://www.flickr.com/help/website/?search=rss#109651 and the gallery will not show more than 20 images no matter what you set the parameter num to)
  2. num - number of items that you want to display : num=5 will list the latest 5 items
  3. url - the url of the feed or site
  4. target= - sets whether links open up in the same or new window
    • '_self' - links open in the same window (default)
    • '_blank' - links open up in a new window
  5. date_format - what the date format should look like default 'M d, Y' - look at PHP Date format for more info
  6. empty - what it should say if the feed is empty
  7. excerpt_length - the number of character it should display
  8. time_zone - a string that is documented here http://php.net/manual/en/timezones.php - we are setting the default timezone with the http://www.php.net/manual/en/function.date-default-timezone-set.php function (shouldn't really need to define this)
  9. show_author - 'true' or 'false' - false if left out only applies to view = rsswidget
  10. show_date - 'true', 'updated' or 'false' - false if left out only applies to view = rsswidget - 'updated' mean that the dates are being sorted by updated xml filed as opposed to the published date
  11. order_by_date - if set to 0, it will use the order given by the rss feed, if set to 1 (also default value), it will try to re-order posts by date.


[feed url="http://www.publicaffairs.ubc.ca"]

See example below:

Ubc-collab-feed-shortcode-widget.png

Specify on which page you would like this feed to be displayed.

Ubc-collab-feed-shortcode-choose-page.png

Please see the example of the outcome below.

Feed-shortcode-widget.png

Alternatively, you can place RSS shortcode in the main content area of the page. For example,

Ubc-collab-theme-feed-shortcode-insert-page.png

Please see the example of the outcome below.

Feed-shortcode-page.png

For example, you can do something like the following:

[feed 
url="http://services.calendar.events.ubc.ca/cgi-bin/rssCache.pl?mode=rss&month=current"  
view="blog"]

The shortcode above pulls the list of events from UBC Events Calendar and displays the description of the event below the link.

Ubc-collab-feed-shortcode-blog-view.png

Please see below how this shortcode works on the webpage.

Ubc-collab-feed-shortcode-blog-page.png

Here is another shortcode example using parameter "list" and the outcome on the webpage:

[feed 
url="http://services.calendar.events.ubc.ca/cgi-bin/rssCache.pl?mode=rss&month=current" 
view="list"]
Ubc-collab-feed-shortcode-list-page.png

Here is another example of the shortcode being used! [feed url='https://circle.ubc.ca/feed/atom_1.0/2429/42591' view='rsswidget' show_author='true' show_date=updated date_format='l, M d, Y h:i:sA' time_zone="America/Vancouver"]

source: http://wiki.ubc.ca/Documentation:CLF_Advanced_WordPress_Theme/RSS_feed
Did you find this content useful?
46 Yes

Leave a Reply

You must be logged in to post a comment.