Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter jaybuys

    (@jaybuys)

    I never got a response here so I spent some time figuring out a solution myself. If anyone is interested, I solved this problem with custom fields rather than an actual taxonomy…

    The plugin works great but the Feed to Posts functionality stores on the full URL of the feed source, no reference to the Feed ID that you could use to filter by. You can change this by…

    Opening import_posts.php and adding the following lines:
    Approx. Line 649, under the line that defines the $thisLink variable add:
    $thisCat=trim($items["mycatid"]);

    Approx. Line 799, under the line that adds post_meta for the source link add:
    add_post_meta($post_id, 'rssmi_source_id', $thisCat);

    Now each post that gets imported will have an ID number related to the Feed category it came from. This is a custom field and there are a number of ways to use it to filter / sort / etc.

    My quick & easy solution was just to add a “?source=n” querystring variable and pass the ID to it. Add the following lines to your theme’s functions.php file to make that happen:

    function register_source_qv() {
      global $wp;
      $wp->add_query_var( 'source' );
    }
    add_action( 'init', 'register_source_qv' );
    
    function map_source_qv( $wp_query ) {
      if ( $meta_value = $wp_query->get( 'source' ) ) {
        $wp_query->set( 'meta_key', 'rssmi_source_id' );
        $wp_query->set( 'meta_value', $meta_value );
      }
    }
    add_action( 'parse_query', 'map_source_qv' );

    You could also use the meta_key and meta_value parameters in custom queries.

    Hope that helps anyone who may be thinking of doing something similar.

    Plugin Author Allen

    (@amweiss98)

    Thanks Jay
    In my beta version of the next update, all posts will be based on custom fields, which may alleviate this problem…thanks for posting this regardless.

    Allen

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom post types and taxonomies?’ is closed to new replies.