Answers.Body: <p>If you're working with frontend forms, set the permission to use any of these entry types to a specific user group or to admins only. Use <a href="http://buildwithcraft.com/docs/templating/usermodel#isInGroup" rel="nofollow"><code>isInGroup</code></a> or the <a href="http://buildwithcraft.com/docs/templating/usermodel#admin" rel="nofollow"><code>admin</code></a> property:</p>
  
  <pre><code>{% if currentUser.admin %} ... {% endif %}
  {% if currentUser.isInGroup('usersWithSomeEntryTypesHidden') %} ... {% endif %}
  </code></pre>
  
  <p>If you need this in the CP, you could make a plugin that does the same and hides selected entry types from the dropdown using JS. As this is no nice solution, what about making this a feature request to Pixel &amp; Tonic?</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-28T13:52:10.087Z
Answers.Text: Cheers carlcs, I will take a look at making a plugin for this first (got to start somewhere, right?) and if I struggle or decide it's really handy I will let them know about it!
Answers.UserDisplayName: Lighty_46
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-28T13:55:14.647Z
Answers.Text: If you don't need it right now, I'd definitely write them a mail first (maybe this exact feature already made it into Craft 2.3?), @Lighty_46.
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-28T14:15:48.990Z
Answers.Text: Cool, I've gotten in touch with them, if they come back with anything useful I will pop it on here. Thanks again @carlcs.
Answers.UserDisplayName: Lighty_46
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-29T10:21:30.387Z
Answers.Text: I'm wondering if this feature ever made it to the feedback site?
Answers.UserDisplayName: Ian Nebbiolo
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-29T10:54:53.200Z
Answers.Text: @ianisted no, not until now: http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/9072358-limit-entries-per-entry-type
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-28T13:35:25.173Z
Answers.LastActivityDate: 2014-11-28T13:40:46.063Z
Answers.LastEditDate: 2014-11-28T13:40:46.063Z
Answers.UserDisplayName: carlcs
Answers.Body: <p>If you make your own plugin, you can check the number of entries in a section before saving it using <a href="http://buildwithcraft.com/docs/plugins/hooks-and-events" rel="nofollow">events</a>. Following code would go in your main plugin file.</p>
  
  <pre><code>public function init() {
      craft()-&gt;on('entries.onBeforeSaveEntry', function(Event $event) {
  
          $criteria = craft()-&gt;elements-&gt;getCriteria(ElementType::Entry);
          $criteria-&gt;section = 'mySection';
          $criteria-&gt;status = 'null';
          $myEntries = $criteria-&gt;find();
  
          if (count($myEntries) &gt; 99) {
              $event-&gt;performAction = false;
          }
      }
  }
  </code></pre>
  
  <p>You could add an admin or permissions check if an admin should be able to add 101 entries.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-29T20:18:19.750Z
Answers.LastActivityDate: 2015-07-29T20:18:19.750Z
Answers.UserDisplayName: David Rampersad
Answers.Body: <p>This is such a good question! (I'm new to Craft, and am <em>very</em> surprised this isn't possible out-of-the-box.) I figured out a hacky but not-too-crazy way to hide entry types from the select menu (as opposed to an event that prevents it from being saved after it is selected, which is a bad user experience):</p>
  
  <ol>
  <li>Install this nifty <a href="https://github.com/lindseydiloreto/craft-cpcss" rel="nofollow">Control Panel CSS plugin</a></li>
  <li>Figure out the entry type id (look in the database or inspect the source of the dashboard page and see what the option values are in the entry types dropdown).</li>
  <li><p>Add some CSS like the following to that plugin's CP page:</p>
  
  <p><code>#entry-form #entryType option:not(:checked)[value="4"] { display: none; }</code></p></li>
  <li>Add as many of those lines as you need for each of your entry types you want to hide.</li>
  </ol>
  
  <p>Or if you'd rather go off the entry name instead of id (or you don't want to rely on those CSS3 selectors due to old browser support), you could achieve the same thing with some jquery, using the <a href="https://github.com/lindseydiloreto/craft-cpjs" rel="nofollow">Control Panel JS plugin</a>:</p>
  
  <pre><code>$(function() {
      var hiddenEntryTypes = [
          'Blog Index',
          'Employees Index',
          'Some other entry type name'
      ];
      $('#entry-form #entryType option:not(:selected)').each(function() {
          if (hiddenEntryTypes.indexOf($(this).html()) &gt; -1) {
              $(this).hide();
          }
      });
  });
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-04T04:47:56.327Z
Answers.LastActivityDate: 2015-08-04T04:47:56.327Z
Answers.UserDisplayName: Jordan Lev
Body: <p>I've structured my site so that most of the pages are in a single structure section (easier to manage that way and it means all my pages can be outputted and organised in the navigation's <code>{% nav %}</code> tag).</p>
  
  <p>I've set up pages that have their own templates and would have been singles as new entry types (e.g. contact page, register form or members area) but it means that the user might try to add another one of those sections in, which I don't want them doing.</p>
  
  <p>So is there a way to limit how many times an entry type can be used?</p>
  
Tags: <structure><entry-type>
Title: Is it possible to limit how many times and entry type can be used?
ThreadText: # Is it possible to limit how many times and entry type can be used?
  
  (Asked by: username_0 on 2014-11-28)
  
  I've structured my site so that most of the pages are in a single structure section (easier to manage that way and it means all my pages can be outputted and organised in the navigation's `{% nav %}` tag).
  
  I've set up pages that have their own templates and would have been singles as new entry types (e.g. contact page, register form or members area) but it means that the user might try to add another one of those sections in, which I don't want them doing.
  
  So is there a way to limit how many times an entry type can be used?
  
  **Tags:** structure, entry-type
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2014-11-28. Score: 2 | Accepted answer
  
  If you're working with frontend forms, set the permission to use any of these entry types to a specific user group or to admins only. Use [`isInGroup`](http://buildwithcraft.com/docs/templating/usermodel#isInGroup) or the [`admin`](http://buildwithcraft.com/docs/templating/usermodel#admin) property:
  
  ```
  {% if currentUser.admin %} ... {% endif %}
  {% if currentUser.isInGroup('usersWithSomeEntryTypesHidden') %} ... {% endif %}
  
  ```
  
  If you need this in the CP, you could make a plugin that does the same and hides selected entry types from the dropdown using JS. As this is no nice solution, what about making this a feature request to Pixel & Tonic?
  
  > **Comments:**
  > **username_0**: Cheers username_1, I will take a look at making a plugin for this first (got to start somewhere, right?) and if I struggle or decide it's really handy I will let them know about it!  
  > **username_1**: If you don't need it right now, I'd definitely write them a mail first (maybe this exact feature already made it into Craft 2.3?), @username_0.  
  > **username_0**: Cool, I've gotten in touch with them, if they come back with anything useful I will pop it on here. Thanks again @username_1.  
  > **username_2**: I'm wondering if this feature ever made it to the feedback site?  
  > **username_1**: @ianisted no, not until now: http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/9072358-limit-entries-per-entry-type  
  
  ---
  
  ### Answer by username_3 on 2015-07-29. Score: 2
  
  If you make your own plugin, you can check the number of entries in a section before saving it using [events](http://buildwithcraft.com/docs/plugins/hooks-and-events). Following code would go in your main plugin file.
  
  ```
  public function init() {
      craft()->on('entries.onBeforeSaveEntry', function(Event $event) {
  
          $criteria = craft()->elements->getCriteria(ElementType::Entry);
          $criteria->section = 'mySection';
          $criteria->status = 'null';
          $myEntries = $criteria->find();
  
          if (count($myEntries) > 99) {
              $event->performAction = false;
          }
      }
  }
  
  ```
  
  You could add an admin or permissions check if an admin should be able to add 101 entries.
  
  
  ---
  
  ### Answer by username_4 on 2015-08-04. Score: 1
  
  This is such a good question! (I'm new to Craft, and am *very* surprised this isn't possible out-of-the-box.) I figured out a hacky but not-too-crazy way to hide entry types from the select menu (as opposed to an event that prevents it from being saved after it is selected, which is a bad user experience):
  
  1. Install this nifty [Control Panel CSS plugin](https://github.com/lindseydiloreto/craft-cpcss)
  2. Figure out the entry type id (look in the database or inspect the source of the dashboard page and see what the option values are in the entry types dropdown).
  3. Add some CSS like the following to that plugin's CP page:
  
     `#entry-form #entryType option:not(:checked)[value="4"] { display: none; }`
  4. Add as many of those lines as you need for each of your entry types you want to hide.
  
  Or if you'd rather go off the entry name instead of id (or you don't want to rely on those CSS3 selectors due to old browser support), you could achieve the same thing with some jquery, using the [Control Panel JS plugin](https://github.com/lindseydiloreto/craft-cpjs):
  
  ```
  $(function() {
      var hiddenEntryTypes = [
          'Blog Index',
          'Employees Index',
          'Some other entry type name'
      ];
      $('#entry-form #entryType option:not(:selected)').each(function() {
          if (hiddenEntryTypes.indexOf($(this).html()) > -1) {
              $(this).hide();
          }
      });
  });
  
  ```
  
  
  ---
  
  