Support » Plugin: DW Social Feed » [Plugin: DW Social Feed] Added hack for Tags

  • I thought I’d share a hack I added that takes the <category> tags from the RSS feed and adds them as tags to the post.
    in the function dwsf_custom_insert_post
    under

    $excerpt = $entry->contentSnippet;

    add

    $tags = $entry->categories;

    within the

    if( !is_object($post_id) && $post_id ){

    added

    if (count($tags) > 0) {
    	foreach ($tags AS $k => $tag) {
    		$istag = get_term_by( 'name', $tag, 'post_tag');
    		if ($istag) {
    			wp_set_post_terms( $post_id, $istag->slug, 'post_tag', true );
    		}
    		else {
    			$newterm = wp_insert_term( $tag, 'post_tag');
    			$newtag = get_term_by( 'id', $newterm['term_id'], 'post_tag');
    			wp_set_post_terms( $post_id, $newtag->slug, 'post_tag', true );
    		}
    	}
    }

    http://wordpress.org/extend/plugins/dw-social-feed/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: DW Social Feed] Added hack for Tags’ is closed to new replies.