Adding a Blog Feed

Issue/Question

How do I add a feed from my WKU Wordpress Blog to my page?

Environment

  • Web CMS
  • WKU Wordpress

Resolution

  1. Log into Web CMS.
  2. From the top menu bar, select Content > Assets (this may take a while to load, be patient).
  3. Select the green New button and choose Source Code.
  4. Under the Asset Info section give your asset a name.
  5. Under the Asset Content section.
    1. Choose PHP from the Syntax drop-down menu.
    2. Copy and paste the code at the bottom of this article into the content box, changing values accordingly.
      • $config['blog'] - the name of the blog you want to create a feed for, this will normally match the first part of the blog url, before the blog.wku.edu
      • $config['categories'] - comma separated list of categories to show in the feed. If this is left blank or not set, it will default to everything
      • $config['style'] - the style number associated to the feed formatting you want, examples can be seen on our Funny Monkeys site, here
      • $config['target'] - if set to "blank", links will open in new tabs/windows
      • $config['show_date'] - only affects Style 4, if "yes", the post's publish date will be added after the post's title
      • $config['show_link_icon'] - only affects Style 3, if "yes", a link (  ) icon will appear after the post's title, to indicate it is a hyperlink
  6. When done, click the blue Create button.
  7. Click the green Publish button to publish the asset.
  8. From the top menu bar, select Content > Pages, and navigate to the page to which you would like to add the feed.
  9. Check Out (  ) the page.
  10. Click Edit (  ).
  11. For the section you want to have the feed, click the green Edit Content Area  ) button.
  12. In the WYSIWYG editor, click where you want the feed to be inserted.
  13. Click the Insert / Edit Asset ( Insert/Edit Asset Icon ) button from the WYSIWYG menu.
  14. When the asset list finishes loading, type the name of the feed asset you created into the filter box; it should be whatever you named your asset in step 4.
  15. Select your feed asset from the list.
  16. Click the Select Asset button.
  17. Click the Save (  ) icon from the WYSIWYG menu.
  18. When you are ready, click the green Publish button to make your changes live.

WKU Blog Feed Asset Code

<?php

// blog name, required
$config['blog'] = 'wkusocial';

// comma separated list of blog categories; defaults to everything if empty or not set
$config['categories'] = 'events,twitter';

// defaults to Style 3 if not set
$config['style'] = 3;

// whether or not to open link in new window/tab
$config['target'] = 'blank';

// load the functions we need and show the feed based on above settings
include_once ('/var/www/html/_resources/php/news_v2/functions.php');
echo blog_display_feed($config);

?>