Issue/Question
How do I add a feed from my WKU Wordpress Blog to my page?
Environment
Resolution
- Log into Web CMS.
- From the top menu bar, select Content > Assets (this may take a while to load, be patient).
- Select the green New button and choose Source Code.
- Under the Asset Info section give your asset a name.
- Under the Asset Content section.
- Choose PHP from the Syntax drop-down menu.
- 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
- When done, click the blue Create button.
- Click the green Publish button to publish the asset.
- From the top menu bar, select Content > Pages, and navigate to the page to which you would like to add the feed.
- Check Out ( ) the page.
- Click Edit ( ).
- For the section you want to have the feed, click the green Edit Content Area ( ) button.
- In the WYSIWYG editor, click where you want the feed to be inserted.
- Click the Insert / Edit Asset ( ) button from the WYSIWYG menu.
- 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.
- Select your feed asset from the list.
- Click the Select Asset button.
- Click the Save ( ) icon from the WYSIWYG menu.
- 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);
?>