<?php
/*
Version: 2014.0807
Author: Charles Johnson
Author URI: http://radgeek.com/
License: GPL
*/
add_filter(
/*hook=*/ 'syndicated_post_slug',
/*function=*/ 'fwp_grab_slug_from_feed',
/*order=*/ 10,
/*arguments=*/ 2
);
/**
* fwp_grab_slug_from_feed: Gets the slug to use for a post from a custom
* feed element called <post_name>...</post_name>
*
* @param string $slug The current slug (if any) for the incoming post
* @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 slug to assign to the syndicated post, or NULL to generate
* a slug using WordPress's default procedure.
*/
function fwp_grab_slug_from_feed ($slug, $post) {
$pn = $post->query('/post_name');
if (count($pn) > 0) :
$slug = reset($pn);
endif;
return $slug;
}
This page is a Wiki!
Log in or register an account to edit.