Skip to content
Browse files

added has_archive property and menu_position property

  • Loading branch information...
1 parent e3dc7bf commit 48864cae7238f807be8f0fb83ae0e3e6569cc4d4 @show555 show555 committed with = Mar 13, 2012
View
34 child-plugins/dynamic/dynamic-content.php
@@ -21,7 +21,9 @@ public function __construct($content_type = '', $settings = array())
'capability_type' => 'post',
'icon_url' => '',
'supports' => array('title', 'editor', 'thumbnail', 'author', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions'),
- 'permastructure' => array('identifier' => $this->content_type, 'structure' => '%identifier%'.get_option('permalink_structure'))
+ 'permastructure' => array('identifier' => $this->content_type, 'structure' => '%identifier%'.get_option('permalink_structure')),
+ 'has_archive' => false,
+ 'menu_position' => 25
);
$this->settings = array();
@@ -137,6 +139,16 @@ public function get_type_is_public()
return $this->get_setting('public', true);
}
+ public function get_type_has_archive()
+ {
+ return $this->get_setting('has_archive', false);
+ }
+
+ public function get_type_menu_position()
+ {
+ return $this->get_setting('menu_position', 25);
+ }
+
public function get_type_is_hierarchical()
{
return $this->get_setting('hierarchical', false);
@@ -689,6 +701,14 @@ private function edit_content_type_form($content_handler, $add = true)
<span class="description"><?php _e('This should almost always be Yes.')?></span>
</td>
</tr>
+ <tr valign="top">
+ <th scope="row"><label for="menu_position"><?php echo 'menu_position'; ?></label></th>
+ <td>
+ <input type="text" class="regular-text code" id="menu_position" name="menu_position" value="<?php echo esc_attr($content_handler->get_type_menu_position()); ?>" />
+ &nbsp; &nbsp;
+ <span class="description"><?php echo '5 - below Posts 10 - below Media 15 - below Links 20 - below Pages 25 - below comments ';?></span>
+ </td>
+ </tr>
<?php /* @todo leaving these out for now
<tr valign="top">
<th scope="row"><?php _e('Is Hierarchical?'); ?></th>
@@ -736,6 +756,18 @@ private function edit_content_type_form($content_handler, $add = true)
<span class="description"><?php _e('Should this content be excluded in search results?')?></span>
</td>
</tr>
+ <tr valign="top">
+ <th scope="row"><?php echo 'has_archive?'; ?></th>
+ <td>
+ <label for="has_archive_yes"><?php echo ('Yes') ?></label>
+ <input type="radio" id="has_archive" name="has_archive" value="1"<?php echo $content_handler->get_type_has_archive() ? ' checked="checked"' : ''?> />
+ &nbsp; &nbsp;
+ <label for="has_archive_no"><?php echo ('No') ?></label>
+ <input type="radio" id="has_archive" name="has_archive" value="0"<?php echo !$content_handler->get_type_has_archive() ? ' checked="checked"' : ''?> />
+ &nbsp; &nbsp;
+ <span class="description"><?php echo 'Use custom_post_type_archives?';?></span>
+ </td>
+ </tr>
</table>
<br />
<h3><?php _e('Permalink Structure')?></h3>
View
4 cp-custom-content/cp-custom-content-core.php
@@ -103,7 +103,9 @@ public function setup_custom_content()
'supports'=> $handler->get_type_supports(),
'rewrite' => $handler->get_type_rewrite(),
'query_var' => $handler->get_type_query_var(),
- 'show_ui' => (bool)$handler->get_type_show_ui()
+ 'show_ui' => (bool) $handler->get_type_show_ui(),
+ 'has_archive' => (bool) $handler->get_type_has_archive(),
+ 'menu_position' => (int) $handler->get_type_menu_position()
);
if($edit_link = $handler->get_type_edit_link())
View
4 cp-custom-content/cp-custom-content-handler-base.php
@@ -966,6 +966,10 @@ public function get_type_exclude_from_search();
public function get_type_publicly_queryable();
public function get_type_show_ui();
+
+ public function get_type_has_archive();
+
+ public function get_type_menu_position();
/**
* returns the edit link for the content type

0 comments on commit 48864ca

Please sign in to comment.
Something went wrong with that request. Please try again.