[ hide ]

    The syndicated_item_title hook allows you to write filters which alter or act on the title of posts that are syndicated by FeedWordPress. The hook passes two parameters to any registered filter functions: a string containing the title of the item (as taken from the syndication feed), and an object of class SyndicatedPost representing the syndicated item as a whole.


    This example is taken from the code for the sample filter FWP+: Include source in title.

    Plugin Name: FWP+: Include source in title
    Plugin URI:
    Description: alters the titles of incoming syndicated posts to include the name of the syndication source
    Version: 2010.0205 
    Author: Charles Johnson
    Author URI:
    License: GPL
    • /

    add_filter( /*hook=*/ 'syndicated_item_title', /*function=*/ 'fwp_include_source_in_title', /*order=*/ 10, /*arguments=*/ 2 );

    /** * fwp_include_source_in_title: Gets the title of the syndication source and * includes it in the title of all syndicated posts. * * @param string $title The current title of the syndicated item. * @param SyndicatedPost $post An object representing the syndicated post. * The syndicated item data is contained in $post->item * The syndication feed channel data is contained in $post->feed * The subscription data is contained in $post->link * @return string The new title to give the syndicated item. */ function fwp_include_source_in_title ($title, $post) { // Use SyndicatedLink::name() to retrieve source name $name = $post->link->name();

    // Put the source name into the title $title = "[1] $title";

    // Send it back return $title; } /* fwp_include_source_in_title() */
    This page is a Wiki! Log in or register an account to edit.

    2 thoughts on “syndicated_item_title

    Leave a Reply

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