Skip to content

feat: improve taxonomy setting UI #1126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion css/settings.css
Original file line number Diff line number Diff line change
Expand Up @@ -560,11 +560,40 @@ fieldset[disabled] .form-control {
}
.fz-form-wrap .chosen-container .chosen-results li{
padding: 8px;
font-weight: 500;
font-weight: 600;
font-size: 16px;
line-height: 19px;
color: #050505;
}
.fz-form-wrap .chosen-container .chosen-results li.group-result{
font-weight: normal;
text-transform: uppercase;
color: #000000bd;
pointer-events: none;
}
.fz-form-wrap .chosen-container .chosen-results li.feedzy-pro-terms{
pointer-events: none;
font-weight: 500;
}
.fz-form-wrap .chosen-container .chosen-results li.feedzy-separator{
font-size: 0;
padding: 0;
border-bottom: 1px solid #757575;
height: 0;
}
.fz-form-wrap .chosen-container .chosen-results li.feedzy-pro-term{
display: flex;
align-items: center;
gap: 10px;
color: #757575;
pointer-events: none;
}
.fz-form-wrap .chosen-container .chosen-results li.feedzy-pro-term .pro-label{
background: #80a2ff;
padding-left: 7px;
padding-right: 7px;
border-radius: 5px;
}
.fz-form-wrap .chosen-container .chosen-results li:hover,
.fz-form-wrap .chosen-container .chosen-results li.result-selected{
background: #F2F2F2;
Expand Down
15 changes: 15 additions & 0 deletions includes/admin/feedzy-rss-feeds-import.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ public function enqueue_styles() {
feedzy_is_pro() ? 'dashicons-upload' : 'dashicons-lock',
esc_html__( 'Upload Import', 'feedzy-rss-feeds' )
),
'is_pro' => feedzy_is_pro(),
),
)
);
Expand Down Expand Up @@ -502,6 +503,19 @@ public function feedzy_import_feed_options() {
$import_post_term = '[#auto_categories]';
}

if ( feedzy_is_pro() ) {
$custom_terms = array(
'[#item_categories]' => __( 'Item Categories', 'feedzy-rss-feeds' ),
'[#auto_categories]' => __( 'Auto Categories by keyword', 'feedzy-rss-feeds' ),
);
} elseif ( ! feedzy_is_pro() ) {
$custom_terms = array(
'[#item_categories]' => __( 'Item Categories', 'feedzy-rss-feeds' ) . sprintf( '<span class="pro-label">%s</span>', __( 'PRO', 'feedzy-rss-feeds' ) ),
'[#auto_categories]' => __( 'Auto Categories by keyword', 'feedzy-rss-feeds' ) . sprintf( '<span class="pro-label">%s</span>', __( 'PRO', 'feedzy-rss-feeds' ) ),
);
}
$custom_post_term = wp_json_encode( $custom_terms );

$import_link_author_admin = get_post_meta( $post->ID, 'import_link_author_admin', true );
$import_link_author_public = get_post_meta( $post->ID, 'import_link_author_public', true );

Expand Down Expand Up @@ -661,6 +675,7 @@ public function save_feedzy_import_feed_meta( $post_id, $post ) {
$data_meta['import_use_external_image'] = isset( $data_meta['import_use_external_image'] ) ? $data_meta['import_use_external_image'] : 'no';
// Check feeds remove html checkbox checked OR not.
$data_meta['import_remove_html'] = isset( $data_meta['import_remove_html'] ) ? $data_meta['import_remove_html'] : 'no';
$data_meta['import_post_term'] = isset( $data_meta['import_post_term'] ) ? $data_meta['import_post_term'] : '';

// If it is filter_conditions we want to escape it.
if ( isset( $data_meta['filter_conditions'] ) ) {
Expand Down
57 changes: 22 additions & 35 deletions includes/views/import-metabox-edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class="dashicons dashicons-arrow-down-alt2"></span>
<label class="form-label"><?php esc_html_e( 'The post type you want to use for the generated post.', 'feedzy-rss-feeds' ); ?></label>
<div class="mx-320">
<select id="feedzy_post_type" class="form-control feedzy-chosen" name="feedzy_meta_data[import_post_type]"
data-tax="<?php echo esc_attr( $import_post_term ); ?>">
data-tax="<?php echo esc_attr( $import_post_term ); ?>" data-custom-tag="<?php echo esc_attr( isset( $custom_post_term ) ? $custom_post_term : '' ); ?>">
<?php
foreach ( $post_types as $_post_type ) {
?>
Expand All @@ -181,57 +181,44 @@ class="dashicons dashicons-arrow-down-alt2"></span>
</div>
<div class="fz-right">
<div class="fz-form-group">
<label class="form-label"><?php esc_html_e( 'Assigns the post to a Category', 'feedzy-rss-feeds' ); ?></label>
<div class="mx-320">
<select id="feedzy_post_terms" multiple class="form-control feedzy-chosen<?php echo feedzy_is_pro() ? ' fz-chosen-custom-tag' : ''; ?>"
name="feedzy_meta_data[import_post_term][]">
</select>
</div>
<div class="help-text pt-8">
<?php esc_html_e( 'The imported post will be assigned to a selected taxonomy. Leave it blank if you don\'t need a taxonomy.', 'feedzy-rss-feeds' ); ?>
<?php esc_html_e( 'If you don\'t select at least one taxonomy, posts will be assigned to Uncategorized by default.', 'feedzy-rss-feeds' ); ?>
</div>
</div>
<?php if ( ! feedzy_is_pro() ) : ?>
<div class="upgrade-alert">
<?php if ( feedzy_is_pro() ) : ?>
<div class="help-text pt-8">
<?php
echo wp_kses_post(
sprintf(
// translators: %1$s: opening anchor tag, %2$s: closing anchor tag.
__( 'Add more advanced tags, like item categories and custom field, by %1$s upgrading to Feedzy Pro %2$s', 'feedzy-rss-feeds' ),
'<a href="' . esc_url( tsdk_translate_link( tsdk_utmify( FEEDZY_UPSELL_LINK, 'moreadvanced' ) ) ) . '" target="_blank">',
// translators: %1$s: magic tag, %2$s: opening anchor tag, %3$s: closing anchor tag.
__( 'Auto-create categories from source: %1$s %2$s Learn More %3$s', 'feedzy-rss-feeds' ),
'<strong>[#item_categories]</strong>',
'<a href="' . esc_url( 'https://docs.themeisle.com/article/1154-how-to-use-feed-to-post-feature-in-feedzy#dynamic-post-taxonomy' ) . '" target="_blank">',
'</a>'
)
);
?>
</div>
<?php endif; ?>
<div class="help-text pt-8">
<?php
echo wp_kses_post(
sprintf(
// translators: %1$s: magic tag, %2$s: opening anchor tag, %3$s: closing anchor tag.
__( 'You can automatically create categories with a magic tag %1$s or use custom tag parsing %2$s Read More %3$s .', 'feedzy-rss-feeds' ),
'<strong>[#item_categories]</strong>',
'<a href="' . esc_url( 'https://docs.themeisle.com/article/1154-how-to-use-feed-to-post-feature-in-feedzy#dynamic-post-taxonomy' ) . '" target="_blank">',
'</a>'
)
);
?>
</div>
<div class="help-text pt-8">
<?php
// phpcs:ignore WordPress.WP.I18n.MissingTranslatorsComment
echo wp_kses_post(
sprintf(
// translators: %1$s: magic tag, %2$s: opening anchor tag, %3$s: closing anchor tag.
__( 'You can automatically assign categories with a magic tag %1$s by the keywords used in title. Configure it %2$s here%3$s .', 'feedzy-rss-feeds' ),
'<strong>[#auto_categories]</strong>',
'<a href="' . esc_url( get_admin_url( null, 'admin.php?page=feedzy-settings' ) ) . '" target="_blank">',
'</a>'
)
);
<div class="help-text pt-8">
<?php
// phpcs:ignore WordPress.WP.I18n.MissingTranslatorsComment
echo wp_kses_post(
sprintf(
// translators: %1$s: magic tag, %2$s: opening anchor tag, %3$s: closing anchor tag.
__( 'Auto-assign by title keywords: %1$s %2$s Configure %3$s', 'feedzy-rss-feeds' ),
'<strong>[#auto_categories]</strong>',
'<a href="' . esc_url( get_admin_url( null, 'admin.php?page=feedzy-settings' ) ) . '" target="_blank">',
'</a>'
)
);
?>
</div>
</div>
<?php endif; ?>
</div>
</div>

Expand Down
90 changes: 69 additions & 21 deletions includes/views/js/import-metabox-edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@
function update_taxonomy() {
const selected = $(this).val();
let tax_selected = $(this).data('tax');
const custom_tag = $(this).data('custom-tag');
if (typeof tax_selected !== 'undefined') {
tax_selected = tax_selected.split(',');
} else {
Expand Down Expand Up @@ -239,8 +240,37 @@
tax_selected = tax_selected.filter(function (item) {
return '' !== item;
});
const selected_tax_length = tax_selected.length;
if (!feedzy.i10n.is_pro) {
options +=
'<optgroup class="feedzy-pro-terms" label="Pro">';
}
options +=
'<option class="feedzy-separator">separator</option>';
$.each(custom_tag, function (key, customTag) {
let is_selected = '';
if (in_array(key, tax_selected)) {
is_selected = 'selected';
const index = tax_selected.indexOf(key);

if (-1 !== index) {
tax_selected.splice(index, 1);
}
}
options +=
'<option class="' +
(!feedzy.i10n.is_pro ? 'feedzy-pro-term' : '') +
'" value="' +
key +
'"' +
is_selected +
'>' +
customTag +
'</option></a>';
});

if (
tax_selected.length > 0 &&
selected_tax_length > 0 &&
$('#feedzy_post_terms').hasClass('fz-chosen-custom-tag')
) {
$.each(tax_selected, function (index, customTag) {
Expand All @@ -252,6 +282,10 @@
'</option>';
});
}

if (!feedzy.i10n.is_pro) {
options += '</optgroup>';
}
} else {
show_terms = false;
options = $('#empty_select_tpl').html();
Expand Down Expand Up @@ -1146,22 +1180,22 @@
}

function feedzyTab() {
$(".fz-tabs-menu a").click(function () {
$(this).parents(".fz-tabs-menu").find("a").removeClass("active");
$(this).addClass("active");
var tagid = $(this).data("id");
$('.fz-tabs-menu a').click(function () {
$(this).parents('.fz-tabs-menu').find('a').removeClass('active');
$(this).addClass('active');
const tagid = $(this).data('id');
$(this)
.parents(".feedzy-accordion-item__content")
.find(".fz-tabs-content .fz-tab-content")
.parents('.feedzy-accordion-item__content')
.find('.fz-tabs-content .fz-tab-content')
.hide();
$("#" + tagid).show();
$('#' + tagid).show();
});
$(".fz-tabs-content .fz-tab-content").hide();
$(".fz-tabs-menu").each(function() {
$(this).find("a").first().addClass("active");
$('.fz-tabs-content .fz-tab-content').hide();
$('.fz-tabs-menu').each(function () {
$(this).find('a').first().addClass('active');
});
$(".fz-tabs-content").each(function() {
$(this).find(".fz-tab-content").first().show();
$('.fz-tabs-content').each(function () {
$(this).find('.fz-tab-content').first().show();
});
}

Expand Down Expand Up @@ -1279,7 +1313,7 @@

$('.feedzy-remove-media').on('click', function () {
if (
$('#use-inherited-thumbnail').length &&
$('#use-inherited-thumbnail').length &&
$('#use-inherited-thumbnail').is(':checked')
) {
return false;
Expand All @@ -1290,25 +1324,39 @@
'change',
function () {
const selectedValue = $(this).val();
const thumbnailValue = $('input[name="feedzy_meta_data[default_thumbnail_id]"]').val();
const hasImagePreview = $('#custom-fallback-section .feedzy-media-preview').length > 0;
const hasThumbnails = (thumbnailValue && thumbnailValue !== '' && thumbnailValue !== '0') || hasImagePreview;
const thumbnailValue = $(
'input[name="feedzy_meta_data[default_thumbnail_id]"]'
).val();
const hasImagePreview =
$('#custom-fallback-section .feedzy-media-preview').length >
0;
const hasThumbnails =
(thumbnailValue &&
thumbnailValue !== '' &&
thumbnailValue !== '0') ||
hasImagePreview;

if (selectedValue === 'custom') {
$('#custom-fallback-section').show();
$('#general-fallback-preview').hide();

if (hasThumbnails) {
$('.feedzy-open-media').html(feedzy.i10n.action_btn_text_2);
$('.feedzy-open-media').html(
feedzy.i10n.action_btn_text_2
);
$('.feedzy-remove-media').addClass('is-show');
} else {
$('.feedzy-open-media').html(feedzy.i10n.action_btn_text_1);
$('.feedzy-open-media').html(
feedzy.i10n.action_btn_text_1
);
$('.feedzy-remove-media').removeClass('is-show');
}
} else if (selectedValue === 'general') {
$('#custom-fallback-section').hide();
$('#general-fallback-preview').show();
$('input[name="feedzy_meta_data[default_thumbnail_id]"]').val('');
$(
'input[name="feedzy_meta_data[default_thumbnail_id]"]'
).val('');
}
}
);
Expand Down
Loading