AnsPress_Dashboard::anspress_feed()

Description #

AnsPress feed.

Source #

File: admin/views/dashboard.php

	public static function anspress_feed() {
		$rss = fetch_feed( 'https://anspress.io/feed/' );
		set_transient( 'anspress_feed', $rss );

		?>
			<div class="anspress_feed">
				<?php
				if ( ! $rss->get_item_quantity() ) {
					echo '<p>'.__( 'Apparently, there are no updates to show!','anspress-question-answer' ).'</p>';
					$rss->__destruct();
					unset($rss );
					return;
				}
				?>
				<ul class="post-list">
					<?php foreach ( $rss->get_items(0, 5 ) as $item ) : ?>
						<li>
							<a target="_blank" href="<?php echo esc_url( strip_tags( $item->get_link() ) ); ?>"><?php echo esc_html( $item->get_title() ); ?></a> -
							<span class="posted"><?php echo $item->get_date('j F Y | g:i a' ); ?></span>
						</li>
					<?php endforeach; ?>
				</ul>
				<?php
					$rss->__destruct();
					unset($rss );
				?>
			</div>
		<?php
	}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment