SHOW:
|
|
- or go back to the newest paste.
1 | <?php | |
2 | ||
3 | /**** | |
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*/ |
9 | + | <?php if ($maxitems == 0) echo '<div>No items.</div>'; else foreach ( $rss_items as $item ) : ?> |
10 | <div class="midia"> | |
11 | - | foreach ($item->get_categories() as $category) |
11 | + | <div class="icone"> |
12 | - | { |
12 | + | <?php echo '<img src="' .get_first_image_url($item->get_content()). '"/>'; ?> |
13 | - | if ($category->get_label() === 'Mobile'){ |
13 | + | |
14 | - | echo '<span class="mobile">'.$category->get_label().'</span>'; |
14 | + | <?php foreach ($item->get_categories() as $category) |
15 | - | } |
15 | + | { |
16 | - | else if ($category->get_label() === 'Coding'){ |
16 | + | if ($category->get_label() === 'Mobile'){ |
17 | - | echo '<span class="coding">'.$category->get_label().'</span>'; |
17 | + | echo '<div class="tipo"><i class="fa fa-video-camera"></i>'.$category->get_label().'</div>'; |
18 | - | } |
18 | + | } |
19 | - | else if ($category->get_label() === 'Android'){ |
19 | + | else if ($category->get_label() === 'Coding'){ |
20 | - | echo '<span class="android">'.$category->get_label().'</span>'; |
20 | + | echo '<div class="tipo"><i class="fa fa-code"></i>'.$category->get_label().'</div>'; |
21 | - | } |
21 | + | } |
22 | - | else { |
22 | + | else if ($category->get_label() === 'Android'){ |
23 | - | echo '<span>'.$category->get_label().'</span>';// gets the remainder of the categories - can also be omitted |
23 | + | echo '<div class="tipo"><i class="fa fa-android"></i>'.$category->get_label().'</div>'; |
24 | - | } |
24 | + | } |
25 | - | }?> |
25 | + | else { |
26 | echo '<div class="tipo"><i class="fa fa-heart"></i>'.$category->get_label().'</div>'; | |
27 | } | |
28 | }?> | |
29 | </div> | |
30 | <div class="mid-tit"><a href='<?php echo esc_url( $item->get_permalink() ); ?>' title='<?php echo esc_html( $item->get_title() ); ?>'> <?php echo esc_html( $item->get_title() ); ?></a></div> | |
31 | </div> | |
32 | <?php endforeach; ?> |