Autoblog: Display Feed Title and other Feed Meta

Hey,

I'm working on a project where I am using Autoblog to generate a lot of posts. Basically I am trying to figure out how I can display the Feed Title that I set in Autoblog that the post is getting created from.

If for instance I was pulling a feed Called "WPMU Feed" from the a feed url of "http://wpmudev.org/feed" I want to display

"The Article title" from "WPMU Feed"
Then the content obviously below.

Thanks for the help.

  • Philip John

    Hiya!

    This is actually something I've wanted to do. My preferred solution (though I've not implemented it yet) is to use a very small custom plugin.

    Basically, I add a specific tag for each feed so that I can detect, per post, which feed it's come from.

    The idea is that my small plugin simply checks for the presence of the tags and if it finds one it automatically appends the text to the bottom of the content.

    The code would be something like;

    // check for the feed tag
    function add_feed_source_to_content($content) {
      // get the tags for this post
      $tags = wp_get_post_tags($post->ID);
    
      // run through each tag and see if it matches one of our feeds
      foreach ($tags as $tag){
        switch ($tag){
          case "wpmuorg":
            $content .= "<p>Original source: <a href="https://premium.wpmudev.org/blog/">WPMU.org</a>";
            break;
          case "wpmudev":
            $content .= "<p>Original source: <a href="https://premium.wpmudev.org">WPMU DEV</a>";
            break;
        }
      }
    
      // otherwise returns the database content
      return $content;
    }
    
    add_filter( 'the_content', 'add_feed_source_to_content' );

    It's not test so be careful about using it but gives you an idea. It's also pretty dumb because it requires you to hard-code the additional content.

    I will ask the developer though if there's room for adding hooks into the plugin for this kind of thing. I.e. we could have a hook that would allow you to append content when the feed is imported....

    Phil

  • cove40

    Hey Phil,

    Thanks for the quick reply. Love the simplicity of your solution but unfortunately sense this is for a client who I also want to be able add new feeds it probably doesn't quite fit the bill though it may be short term solution.

    It seems that one good solution would be to include the Feed / Source Title (including the link to it) in as post meta data. Basically having it be saved along with the post. Then it would be easy to use wordpress core functionality to pull it out of the database etc. I also think this functionality would go a long way in making sure full credit is given to the original source.

    Look forward to hearing more.

    Ryan

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.