The MU forums have moved to WordPress.org

FeedFlare (3 posts)

  1. SteveAtty
    Member
    Posted 16 years ago #

    Anyone looked at FeedFlare (feedburner stats) and how it could integrate with WPMU.

    They suggest embedding it in the index.php and single.php by using the theme editor.

    Obviously on WPMU this isn't really ideal and I wonder wondering if its worth hacking the templates to insert the code automatically if they've activiated feed burner and have activated stats.

    Basically the code they want you to add is :

    <script src="http://feeds.feedburner.com/~s/feednamehere?i=<?php the_permalink() ?>" type="text/javascript" charset="utf-8"></script>

    So all I'd need to do is get the feedname from the tail end of the feedburner_url and output the code if they've set an optional "stats" flag.

    Does this make sense?

    Edited : As Feedburner suggest putting the code in right before the <p class="postmetadata"> tag then can it simply be hooked in thus avoiding editing all the templates?

  2. JeremyVisser
    Member
    Posted 16 years ago #

    It's really easy to do. Just write a plugin that hooks into the end of the_content. A 30-second example by me:

    <?php
    /*
      Plugin Name: FeedFlare
      Plugin Author: Jeremy Visser
    */
    
    function jv_feedflare($s) {
      return $s . '<script src="http://feeds.feedburner.com/~s/feednamehere?i=' . get_the_permalink() . '" type="text/javascript" charset="utf-8"></script>';
    }
    
    add_filter('the_content', 'jv_feedflare');
    
    ?>

    Writing a Plugin is a good read at the Codex.

  3. SteveAtty
    Member
    Posted 16 years ago #

    Actually their code is not right for WPMU and if you are embedding it then you need to make a couple of tweaks to automatically get the feed name from the feedsmith config:

    So the code needs to look like this:

    $feedburner_settings = get_option('feedburner_settings');
    if (isset($feedburner_settings)) {print '<script src="http://feeds.feedburner.com/~s'.parse_url($feedburner_settings['feedburner_url'],PHP_URL_PATH).'?i='.get_permalink($post->ID).'" type="text/javascript" charset="utf-8"></script>'; }

    I actually found some plugin code that was hooking into the content so thats what I added to it.

About this Topic

  • Started 16 years ago by SteveAtty
  • Latest reply from SteveAtty