-
Notifications
You must be signed in to change notification settings - Fork 2
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
Added limit posts by post type #3
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,8 @@ | |
<input name="wpsite_limit_posts_settings_all_users" type="radio" value="capability" <?php echo isset($settings['all']) && $settings['all'] == 'capability' ? 'checked="checked"' : ''; ?>><label><?php _e('Role', self::$text_domain); ?></label><br /> | ||
|
||
<input name="wpsite_limit_posts_settings_all_users" type="radio" value="user" <?php echo isset($settings['all']) && $settings['all'] == 'user' ? 'checked="checked"' : ''; ?>><label><?php _e('User', self::$text_domain); ?></label> | ||
|
||
<input name="wpsite_limit_posts_settings_all_users" type="radio" value="post_type" <?php echo isset($settings['all']) && $settings['all'] == 'post_type' ? 'checked="checked"' : ''; ?>><label><?php _e('Post Type', self::$text_domain); ?></label> | ||
</td> | ||
</th> | ||
</tr> | ||
|
@@ -96,6 +98,37 @@ | |
|
||
?> | ||
|
||
<!-- List all Post Types --> | ||
|
||
<?php | ||
|
||
$all_post_types_public = get_post_types(array('public'=> true),'names'); | ||
$all_post_types = array(); | ||
$post_types = array(); | ||
|
||
foreach ($all_post_types_public as $a){ | ||
if ($a != 'attachment'){ | ||
$all_post_types[] = $a; | ||
} | ||
} | ||
foreach ($all_post_types as $post_type) { | ||
$post_types[] = $post_type; | ||
} | ||
|
||
foreach ($post_types as $post_type) { | ||
?><tr class="wpsite_limit_posts_post_type"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove this class to allow the setting to show all the time. |
||
<th class="wpsite_limit_posts_admin_table_th"> | ||
<label><?php _e($post_type, self::$text_domain); ?></label> | ||
<td class="wpsite_limit_posts_admin_table_td"> | ||
<input id="wpsite_limit_posts_settings_<?php echo $post_type; ?>" name="wpsite_limit_posts_settings_<?php echo $post_type; ?>" type="text" size="10" value="<?php echo isset($settings['post_type_limit'][$post_type]) ? esc_attr($settings['post_type_limit'][$post_type]) : ''; ?>"><br/> | ||
<em><?php _e("Default: -1 (i.e. umlimited)", self::$text_domain); ?></em> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make the default value -1 by changing this:
to this
|
||
</td> | ||
</th> | ||
</tr><?php | ||
} | ||
|
||
?> | ||
|
||
</tbody> | ||
</table> | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove this line since the Limit by Post Type option should be independent from the Limit by User