Permalink
Browse files

Added support for taking the Instagram-Tags as Wordpress-taxonomy.

The taxonomy must be set in plugin-settings.
  • Loading branch information...
csenf committed Jan 15, 2013
1 parent 10eac74 commit 5816ddade00b92fa0975fb47b49ca8467779e2a4
Showing with 43 additions and 0 deletions.
  1. +15 −0 dsgnwrks-instagram-importer.php
  2. +28 −0 settings.php
@@ -396,6 +396,21 @@ protected function save_img_post() {
update_post_meta( $new_post_id, 'geo_public', true );
}
+ // Tags
+ if (!empty($settings['autotag']) && $settings['taxonomy_tag'] !== 'none') {
+ $tags = $p->tags;
+
+ $tag_string = '';
+
+ if (!empty($tags)) {
+ $tag_string .= implode(', ', $tags);
+ }
+
+ if (!empty($tag_string) || $tag_string != ''){
+ wp_set_post_terms($new_post_id, $tag_string, $settings['taxonomy_tag'], true);
+ }
+ }
+
return $this->upload_img( $imgurl );
}
View
@@ -395,6 +395,34 @@
}
?><tr valign="top">
+ <th scope="row">
+ <label for="dsgnwrks_insta_options[<?php echo $id; ?>][taxonomy_tag]"><strong>Taxonomy for tags</strong></label>
+ </th>
+ <td>
+ <?php
+ $taxonomies = get_object_taxonomies(isset( $o['post-type'] ) ? $o['post-type'] : 'post','objects');
+ ?>
+ <select id="dsgnwrks_insta_options[<?php echo $id; ?>][taxonomy_tag]" name="dsgnwrks_insta_options[<?php echo $id; ?>][taxonomy_tag]">
+ <option value="none">None</option>
+ <?php foreach ($taxonomies as $key => $tax):
+
+ if($tax->hierarchical != 0 || $key == 'post_format' )
+ continue;
+ ?>
+ <option value="<?php echo $key ?>" <?php selected($key, $o['taxonomy_tag']) ?>><?php echo $tax->labels->name ?></option>
+ <?php endforeach ?>
+ </select>
+ </td>
+ </tr>
+ <tr valign="top">
+ <th scope="row">
+ <label><strong>Auto set tag:</strong><br/>Uses the tags from instagram</label>
+ </th>
+ <td>
+ <input type="checkbox" name="dsgnwrks_insta_options[<?php echo $id; ?>][autotag]" <?php checked( isset( $o['autotag'] ) ); ?> value="yes"/>
+ </td>
+ </tr>
+ <tr valign="top">
<th scope="row">
<label><strong>Auto set Geolocation</strong><br/></label>
</th>

0 comments on commit 5816dda

Please sign in to comment.