get_syndication_source

Contents

[ hide ]

    The get_syndication_source() template tag can be used in templates to retrieve the title of the source that a given 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 $title = get_syndication_source(); ?>
         <p class="source">This syndicated post originally appeared at <a
         href="<?php the_syndication_source_link(); ?>"><?php
         print htmlspecialchars($title); ?></a> on <a
         href="<?php print get_syndication_permalink(); ?>"><?php
         the_time('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 get_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

    Returns a string containing the text of the title, if FeedWordPress knows the source from which this item was syndicated; NULL if the post was not syndicated.

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

    Leave a Reply

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

    *

    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>