Thanks for the quick response! Could you be a bit more detailed about the import/export function, to reorder the taxonomies? OR maybe i am a bit mor detailed to ??
We bought a code “customization” from another Plugin team, to handle taxonomy metaboxes in the frontendupload. These are set the way the taxonomies are in the cpt ui backend.
So my idea was, to reorder the taxonomies and all is good.
Or is there a quick way for you to find a solution in this code?
<?php
if(!defined("ABSPATH")) die();
$taxonomies = get_object_taxonomies( 'wpdmpro' );
$taxonomies = array_diff($taxonomies, ['wpdmcategory', 'wpdmtag']);
foreach ($taxonomies as $taxonomy){
$taxonomyObj = get_taxonomy($taxonomy);
//wpdmprecho($taxonomyObj);
?>
<div class="card wpdmap-card-filter mb-3" id="<?= $taxonomy ?>-section" <?php if (in_array($taxonomy, $hide)) { ?>style="display: none"<?php } ?>>
<div class="card-header">
<?= $taxonomyObj->label; ?>
</div>
<div class="card-header p-2 filter-header"><input placeholder="<?php echo __( "Search...", "download-manager" ) ?>" type="search" class="form-control form-control-sm bg-white input-sm" id="<?= $taxonomy ?>_src" /></div>
<div class="card-body tag-card">
<ul id="wpdm-<?= $taxonomy ?>" class="wpdm-taxonomy">
<?php
$term_list = wp_get_post_terms($post->ID, $taxonomy, array("fields" => "all"));
$selectedterms = array();
foreach ($term_list as $__term) {
$selectedterms[] = $__term->term_id;
}
$terms = get_terms(['taxonomy' => $taxonomy, 'hide_empty' => false]);
foreach($terms as $term){
echo "<li class='wpdm-tag'><label><input type='checkbox' name='taxonomy[{$taxonomy}][]' ".checked(in_array($term->term_id, $selectedterms), true, false)." class='wpdmtag' value='{$term->term_id}'> <span class='tagname'>{$term->name}</span></label></li>";
}
?>
</ul>
</div>
<div class="card-footer">
<div class="input-group">
<input type="text" class="form-control" id="new_term_<?= $taxonomy ?>" />
<div class="input-group-append">
<button type="button" class="btn btn-secondary btn-create-term-wpdm" data-taxonomy="<?= $taxonomy ?>"><i class="fa fa-plus-circle"></i></button>
</div>
</div>
</div>
</div>
<script>
jQuery(function ($) {
$("#<?= $taxonomy ?>_src").on("keyup", function() {
var value = $(this).val().toLowerCase();
$("#wpdm-<?= $taxonomy ?> li").filter(function() {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
});
});
});
</script>
<?php }
?>
<script>
jQuery(function ($){
$('.btn-create-term-wpdm').on('click', function (e){
e.preventDefault();
var tax = $(this).data('taxonomy');
WPDM.blockUI('#'+tax+'-section');
var term = $('#new_term_'+tax).val();
$.get(wpdm_url.ajax, { action: 'wpdm_create_term', term: term, taxonomy: tax, __nonce: '<?= wp_create_nonce(NONCE_KEY); ?>'}, function (response){
if(response.success === true)
$('#wpdm-'+tax).append(response.html);
else
WPDM.bootAlert("<?= __( 'Error', 'download-manager' ); ?>", "<?= __( 'Failed to create term', 'download-manager' ); ?>", 400);
WPDM.unblockUI('#'+tax+'-section');
});
});
});
</script>
<style>
.wpdm-taxonomy, .wpdm-taxonomy li{
list-style: none;
margin: 0;
padding: 0;
font-size: 9pt;
}
.wpdm-taxonomy li label{
font-size: 9pt;
}
</style>
-
This reply was modified 4 years, 1 month ago by
onlineatwork.
-
This reply was modified 4 years, 1 month ago by
onlineatwork.
-
This reply was modified 4 years, 1 month ago by
onlineatwork.
-
This reply was modified 4 years, 1 month ago by
onlineatwork.