WordPress.org

Ready to get started?Download WordPress

Forums

Replace string in RSS Widget? (4 posts)

  1. creinhardt
    Member
    Posted 6 years ago #

    Im using the default wordpress RSS widget to pull in a feed of what TV shows are currently playing on a small TV station. For reasons beyond my control, whenever this TV station plays a certain file, the feed calls it "NA". I have no control over the feed, so I was wondering if it would be possible to use some php to replace that specific string with something else. I've found some php that would let me do this

    <?php
    
    // The text string
    
    $text = "The quick brown fox jumped over the lazy dog.";
    
    // The word we want to replace
    
    $oldWord = "brown";
    
    // The new word we want in place of the old one
    
    $newWord = "blue";
    
    // Run through the text and replaces all occurrences of $oldText
    
    $text = str_replace($oldWord , $newWord , $text);
    
    // Display the new text
    
    echo $text;
    
    ?>

    but i'm not sure where i'd need to put that in my wordpress files, or what variables i'd use to change the rss description. Can anyone help me out with this? For an example, go to http://www.yourconcordtv.org/wptest/ and look at the 'Now Playing' section on the sidebar.

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    You could do that, but using a Yahoo Pipe might be simpler.

    http://pipes.yahoo.com/

    It lets you take a feed or set of feeds, do any sort of things to it that you want using a simple interface, and then create a new feed from that which you can then use as any other feed.

  3. mikelizzio
    Member
    Posted 5 years ago #

    does google offer something similar?

  4. alanft
    Member
    Posted 5 years ago #

    one option would be to use the widget_content filter that my plugin offers

    http://wordpress.org/extend/plugins/widget-logic/

Topic Closed

This topic has been closed to new replies.

About this Topic