The get_syndication_source_link()
template tag can be used in templates to retrieve the URL of the human-readable homepage for the source that a syndicated post was syndicated from. The value can then be stored for later display or processing through PHP functions in your WordPress templates.
Sample
<?php if (is_syndicated()) : ?>
<?php $url = get_syndication_source_link(); ?>
<p class="byline">This is a syndicated post which originally appeared at
<a href="<?php print htmlspecialchars($url) ?>">
<?php the_syndication_source(); ?></a> on
<a href="<?php the_syndication_permalink(); ?>">
<?php the_date('j F Y H:i:s'); ?></a>
</p>
<?php endif; ?>
Declaration
function get_syndication_source_link ($original = NULL, $id = NULL)
Parameters
$original
is an OPTIONAL parameter which determines how the function will handle syndicated posts that were syndicated from aggregator feeds produced by other tools like FeedWordPress. Suppose that your FeedWordPress aggregator is subscribed to a feed from Google Reader, which itself aggregates content from many different sources, and indicates where that content was originally aggregated from. So, for a story from example.com
, the syndication looks like this:
example.com --> Google Reader --> Your blog
If $original
is FALSE or omitted, get_syndication_source_link()
will return the URL of the aggregator (in this case, Google Reader). If $original
is TRUE, it will return the URL of the original source that the aggregator got it from (in this case, example.com
).
$id
is an OPTIONAL parameter. If specified, it should contain the numerical ID of the post for which to get the original permalink URL. If $id
is NULL, or omitted, FeedWordPress will return the permalink for the current post in the Post Loop.
Return value
Returns a string containing the URL of the human-readable homepage for the source the post was syndicated from; NULL if the post was not syndicated, or if the source feed did not provide a link to a human-readable homepage.
When $original
is FALSE (or omitted), get_syndication_source_link
will return the URL for the homepage of the feed that you are subscribed to, whether or not that feed originally got the post from a different location. When $original
is TRUE, get_syndication_source_link
will return the original source of the feed, before the aggregator resyn