SHOW:
|
|
- or go back to the newest paste.
1 | <?php | |
2 | ||
3 | /**** | |
4 | - | WordPress SimplePie. Display Categories from RSS Feed - http://www.worldoweb.co.uk/2012/display-wordpress-posts-on-another-wp-blog |
4 | + | WordPress SimplePie. Display Categories from RSS Feed and give individual ones their own CSS classes - http://www.worldoweb.co.uk/2012/display-wordpress-posts-on-another-wp-blog |
5 | Please note that Tags may also be displayed as categories within the RSS feed | |
6 | ****/ | |
7 | ||
8 | ||
9 | /*Add inside the main foreach loop*/ | |
10 | ||
11 | - | foreach ($item->get_categories() as $category) |
11 | + | foreach ($item->get_categories() as $category) |
12 | { | |
13 | - | echo '<span>'.$category->get_label().'</span>';//Replace HTML elements with your own |
13 | + | if ($category->get_label() === 'Mobile'){ |
14 | - | } |
14 | + | echo '<span class="mobile">'.$category->get_label().'</span>'; |
15 | } | |
16 | - | ?> |
16 | + | else if ($category->get_label() === 'Coding'){ |
17 | echo '<span class="coding">'.$category->get_label().'</span>'; | |
18 | } | |
19 | else if ($category->get_label() === 'Android'){ | |
20 | echo '<span class="android">'.$category->get_label().'</span>'; | |
21 | } | |
22 | else { | |
23 | echo '<span>'.$category->get_label().'</span>';// gets the remainder of the categories - can also be omitted | |
24 | } | |
25 | }?> |