php - Replace text from generated RSS feeds -
here page problem, http://knowgreaterpartnership.com/secrets/.
the rss generator use inserting inline html tags on "events" feed such <br>
, <i>
, </i>
.
here code i've ended try , remove these bits code:
<div id="right" class="last"> <h1><?php esc_html_e( 'buchanan events', 'fusion' ); ?></h1> <article id="jobs"> <?php if ( function_exists( 'fetch_feed' ) ) { ?> <?php include_once(abspath . wpinc . '/feed.php'); $feed = fetch_feed( 'http://www.bipc.com/rssfeeds/rss.aspx?id=35' ); $feednew = str_replace( array( '<br>', '<i>', '</i>' ), '', $feed ); $limit = $feednew -> get_item_quantity(5); $items = $feednew -> get_items(0, $limit); if ( !$items ) { echo "problem"; } else { //everything's cool foreach( $items $item ){ ?> <h2 class="post"><a class="link" href="<?php echo $item -> get_permalink(); ?>" target="_blank"><?php echo $item -> get_title(); ?></a></h2> <p class="date"><?php echo $item -> get_date( 'f j, y' ); ?></p> <hr> <?php } } ?> <?php } ?> </article> </div>
i'm trying use str_replace() search <br>
, <i>
, </i>
tags , replace them nothing rest of text flows.
if i'm not using right method, please let me know. thanks!
this should work you:
just use strip_tags()
, remove html/php tags (html comments included).
$feed = strip_tags($feed);