get_syndication_feed_object

Contents

[ hide ]

    The get_syndication_feed_object() template tag can be used in templates to get an object representing the source that a syndicated post was syndicated from. The object can be used to get many different kinds of information about the source feed, using the methods built into class SyndicatedLink.

    Sample

    <?php if (is_syndicated()) : ?>
        <?php
            $link = get_syndication_feed_object();
        ?>
        The homepage of this post's source is: <?php print $link->homepage(); ?>
    <?php endif; ?>
    

    This code snippet, when used in the WordPress Post Loop, will display a short notice on all syndicated posts, including the URL for the human-readable homepage of the source from which the the post was syndicated.

    Declaration

    function get_syndication_feed_object ($id = NULL)
    

    Parameters

    $id is an OPTIONAL parameter. If specified, it should contain the numerical ID of the post for which to get the syndication source ID. If $id is NULL, or not specified, FeedWordPress will return the numerical ID for the source of the current post in the Post Loop.

    Return value

    Returns an object of class SyndicatedLink if FeedWordPress can identify 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.

    2 thoughts on “get_syndication_feed_object

    1. Thanks for your work on FWP. I am getting an error:
      Fatal error: Call to a member function setting() on a non-object in /home/MYSITE/wp-content/plugins/feedwordpress/feedwordpress.php on line 637

      I looked and this is basically due to a null returned from the get_syndication_feed_object function on line: $source = get_syndication_feed_object(); in syndication_comments_feed_link.

      should there maybe be a null check before attempting to call member functions on the result from get_syndication_feed_object or is my site borked and this should not happen?

      (it looks like some other places it’s used do the check [e.g. syndication_permalink and get_feed_meta ])

    Leave a Reply

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