WordPress.org

Ready to get started?Download WordPress

Forums

DW Social Feed
Added hack for Tags (2 posts)

  1. alieneila
    Member
    Posted 2 years ago #

    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/

  2. JoomlArt
    Member
    Plugin Author

    Posted 2 years ago #

    wow! so amazing, it help me so much :) thank alieneila

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.