WordPress.org

Ready to get started?Download WordPress

Forums

Author Category
[resolved] Feature request - defined number of avaialable categories (2 posts)

  1. kryvulena
    Member
    Posted 1 year ago #

    I have a kind feature request. I wish authors could be able to select ie. 1, 2 or 3 categories from all categories available but no more than 3. If 3 selected, the rest becomes "dimmed" - impossible to select. The number of categories available per author could be set up in the plugin settings. What about that?

    http://wordpress.org/extend/plugins/author-category/

  2. Bainternet
    Member
    Plugin Author

    Posted 10 months ago #

    Not really the functionality of this plugin but you can do that with this simple jQuery snippet

    add_action('admin_footer-post-new.php','limit_category_selection_count');
    add_action('admin_footer-post.php','limit_category_selection_count');
    function limit_category_selection_count(){
    	$limit = 2; //change this to the number you want to limit
    	?>
    	<script type="text/javascript">
    	jQuery(document).ready(function($){
    		$("input[type=checkbox][name^='post_category']").click(function() {
    		    var bol = $("input[type=checkbox][name^='post_category']:checked").length >= <?pphp echo $limit; ?>;
    		    $("input[type=checkbox][name^='post_category']").not(":checked").attr("disabled",bol);
    		});
    	});
    	</script>
    	<?php
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.