You can use the template tag the_syndication_source()
to display the title of the source that a given syndicated post was syndicated from. This is equivalent to immediately outputting the value returned by get_syndication_source()
.
Sample
<?php if (is_syndicated()) : ?>
<p class="source">This syndicated post originally appeared at <a
href="<?php the_syndication_source_link(); ?>"><?php
the_syndication_source(); ?></a> on <a
href="<?php print get_syndication_permalink(); ?>"><?php
the_date('j F Y'); ?></a></p>
<?php endif; ?>
This code snippet, when used in the WordPress Post Loop, will display a short notice on all syndicated posts, indicating the source from which this imported copy was originally syndicated.
Declaration
function the_syndication_source ($original = NULL, $id = NULL)
Parameters
$original
is an OPTIONAL parameter, which determines how FeedWordPress will handle posts from aggregator feeds (feeds which gather together many different items from many different sources, such as feeds produced by Google Reader or by FeedWordPress itself). Aggregator feeds often provide information about the original source of the items that appear on them. So, for example, a post that appears in a Google Reader feed, but originally appeared on projects.radgeek.com
, will include information indicating that the post originally came from “Rad Geek’s Projects.” In that situation:
-
When
$original
is set to NULL, or left unspecified, FeedWordPress will default to using the setting under Syndication –> Posts & Links –> Links –> Posts from aggregator feeds to determine whether it should return the title of the Google Reader feed, or “Rad Geek’s Projects.” -
When
$original
is set to TRUE, FeedWordPress will return “Rad Geek’s Projects” -
When
$original
is set to FALSE, FeedWordPress will return the title of the Google Reader feed
$id
is an OPTIONAL parameter. If specified, it should contain the numerical ID of the post for which to get the original source title. If $id
is NULL, or not specified, FeedWordPress will return the title of the source for the current post in the Post Loop.
Return value
None. This function displays a value rather than returning it for later processing; if you need to store the value for later processing by PHP, see its companion function get_syndication_source()
.