Support » Fixing WordPress » Code Insertion

  • I am trying to insert code, and it keeps dropping information. I think that this is why it won’t display properly. These are surrounded in the proper code tags with dogears around it.

    <?PHP srssfetcher(‘http://news.google.com/news?hl=en&ned=us&q=%22my+search%22&ie=UTF-8&output=rss’, 20, true, true, true); ?>

    BECOMES

    <!–P srssfetcher(‘http://news.google.com/news?hl=en&ned=us&q=%22my+search%22&ie=UTF-8&output=rss’, 20, true, true, true);–>

Viewing 6 replies - 1 through 6 (of 6 total)
  • I just noticed, it’s not fetcher that’s working as a widget, that’s broken as well. I guess it must be something with the widget. Anyway, is there a way to get the core RSS feed widget to dump out to the main body of a page?

    WP destroys my code all the time.

    Michael Torbert

    (@hallsofmontezuma)

    WordPress Virtuoso

    WordPress will strip out certain tags, like PHP, divs, etc in pages and in posts. http://wordpress.org/extend/plugins/exec-php/ is a great plugin for allowing you to keep your PHP code in posts.

    The following code will dump your rss feed.

    <?php
    $file = fopen(“http://yourdomain.com/rss”, “r”);
    while ( ! feof($file) ) {
    $text = fgets($file);
    ?>

  • <?php echo $text;?>
  • <?php } ?>

    Replace http://yourdomain.com/rss with whatever the path to your wordpress feed is.

Michael Torbert

(@hallsofmontezuma)

WordPress Virtuoso

Sorry, the forum stripped some of my code, although nothing important. But you get the idea. Let me know if this helps.

forum stripped some of my code

Use the “code” button… that’s why it is there: highlight your code and click on that freakin’ button!

Michael Torbert

(@hallsofmontezuma)

WordPress Virtuoso

Thanks Moshu. I realized it after. 🙂
It only took out my li tags as far as I could tell though, which weren’t vital, just made it look better.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Code Insertion’ is closed to new replies.