diff --git a/admin/admin.php b/admin/admin.php index 81e8e2f..0b50a82 100644 --- a/admin/admin.php +++ b/admin/admin.php @@ -44,6 +44,9 @@ function superdesk_admin() { 'copyrightholder-image' => $_POST['copyrightholder-image'], 'copyrightnotice-image' => $_POST['copyrightnotice-image'], 'separator-located' => $_POST['separator-located'], + 'convert-slugline' => $_POST['convert-slugline'], + 'slugline-separator' => $_POST['slugline-separator'], + 'slugline-ignored' => $_POST['slugline-ignored'], ); update_option('superdesk_settings', $settings); } else if (get_option('superdesk_settings')) { @@ -68,6 +71,9 @@ function superdesk_admin() { 'copyrightholder-image' => '', 'copyrightnotice-image' => '', 'separator-located' => '', + 'convert-slugline' => '', + 'slugline-separator' => '', + 'slugline-ignored' => '', ); } $statuses = array( @@ -393,6 +399,46 @@ function superdesk_admin() { + + + Convert slugline keywords into WP tags + + +
+ +
+ +
+ + + + + + + + + + + + + + + + + +

diff --git a/autoload.php b/autoload.php index 732e23d..a30ecc3 100644 --- a/autoload.php +++ b/autoload.php @@ -40,6 +40,19 @@ if ($obj['type'] == 'text') { } } + if ($settings['convert-slugline'] && $settings['convert-slugline'] == 'on') { + if (isset($obj['slugline']) && !empty($obj['slugline'])) { + $ignoreKeywords = explode(',', $settings['slugline-ignored']); + $tmpKeywords = explode($settings['slugline-separator'], $obj['slugline']); + + foreach ($tmpKeywords as $word) { + if (!in_array($word, $ignoreKeywords)) { + $taxonomyTag[] = $word; + } + } + } + } + foreach ($obj['subject'] as $subject) { if ($settings['subject-type'] == 'tags') { $taxonomyTag[] = wp_strip_all_tags($subject['name']);