How do I create a link back to the original source copy of a syndicated post

Contents

[ hide ]

    For more how-tos and advice, return to How Do I …?

    Q. How do I create a link back to the original source copy of a syndicated post?

    A. By default, FeedWordPress automatically provides a link back to the original source of syndicated posts in the permalink to each syndicated post. (The permalink is normally the link provided in the title of the post, and possibly again at the bottom.)

    Some users choose to turn off this feature, under Syndication –> Posts & Links (by changing Permalinks point to from the default setting of “the copy on the original website” to the alternative setting, “the local copy on this website.” When this is done, permalinks on your FeedWordPress-powered website will point to single-post pages on your website, which may be useful if (for example) you want to allow users to leave comments on the story at your website, or if you want to integrate content from remote sources such as a Flickr stream or a Twitter feed more naturally into the design and layout of your main website. However, now you must take some additional steps to make sure that, after the user has gotten to your single-post page, there is still some link back to the original content at its original source. There are two main ways to do this, depending on the trade-off you want to make between usability and flexibility.

    1. The “official” way to do this kind of thing in FeedWordPress — and the way to get the most flexibility and control over how the attribution is presented and what kind of information it includes — is to install one of the themes designed for FeedWordPress or to edit your own WordPress template files, so that you can add the link in the appropriate place in your Post Loop. (You can edit template files directly from the WordPress administrative interface using Appearance –> Theme Editor, or you can edit them in a text editor on your own computer and upload them to your theme directory.)

      The Templates section of the Documentation Wiki documents the template tags that FeedWordPress provides when it is activated; the most important tags for this particular task are is_syndicated() and the_syndication_permalink(). What you’d most likely be adding to your templates is a line something like this, wherever you want it added within your post loop:

      <?php if (is_syndicated()) : ?>
      <p>This is a syndicated post. Read the original at 
      <a href="<?php the_syndication_permalink(); ?>"><?php the_syndication_source(); ?>
      <?php the_time('Y-m-d'); ?></a>.</p>
      <?php endif; ?>
      

      This will create links from each syndicated post that look something like this

      This is is a syndicated post. Read the original at Rad Geek’s Projects 2010-11-08.

    2. Alternatively, if your needs are relatively limited, you can also install a FeedWordPress Add-On like the Add Attribution for FeedWordPress add-on module. Add Attribution creates an Attribution Boilerplate section under the Syndication –> Posts & Links settings page. Compared to working directly with our templates, this method causes you to lose a lot of flexibility in what you can present, and where and how you can present it; but it is handled directly through the admin interface, without having to edit template files.

    Does that answer your question? If not, use the Talk page to comment on this post or contact me by e-mail for help. Be sure to describe what you are trying to do, and the problems you are running into, with as much detail as possible.

    For more how-tos and advice, return to How Do I …?

    This page is a Wiki! Log in or register an account to edit.

    8 thoughts on “How do I create a link back to the original source copy of a syndicated post

    1. Hi,

      I am trying to modify the following code to put the link on the title of the single post at content.php:

      the_title( ‘<a href=”‘ . esc_url( get_permalink() ) . ‘” rel=”nofollow”>’, ‘</a>’ );

      So far I have no idea and tried many different solutions. E.g. the following does not work:

      the_title( ‘<a href=”‘ . esc_url( the_syndication_permalink ) . ‘” rel=”nofollow”>’, ‘</a>’ );

      Is there an easy solution?

      Thanks,
      Juergen

    2. ..and also here. Is there a solution to use that code with the_syndication_permalink:

      the_content( sprintf(
      __( ‘Continue reading %s →’, ‘twentyfourteen’ ),
      the_title( ”, ”, false )
      ) );

    3. I’m basically illiterate when itcomes to php. O_O

      What I want to do is get your “Add source to other people’s content” example to display / link to the original post permalink (instead of the feed URL) … and actually for all syndicated posts (but this is not a major issue).

      It seems like I should use something like “getsyndicationpermalink”, but because IDK much of anything I can’t make it work. Can I create a variable (like $url) inside of the “Add source to content” (.php) file, and somehow assign the permalink to that variable … and then append that to the $content (as you do with the feed URL)?

      I really want the data to be within the content of the post (so that’s why the “Add Attribution” boilerplate doesn’t work for me).

      Thanks for your help! 🙂

    Leave a Reply

    Your email address will not be published. Required fields are marked *