Skip to content
This repository
Browse code

added has_archive property and menu_position property

  • Loading branch information...
commit 48864cae7238f807be8f0fb83ae0e3e6569cc4d4 1 parent e3dc7bf
Shogo Kato show555 authored prettyboymp committed
34 child-plugins/dynamic/dynamic-content.php
@@ -21,7 +21,9 @@ public function __construct($content_type = '', $settings = array())
21 21 'capability_type' => 'post',
22 22 'icon_url' => '',
23 23 'supports' => array('title', 'editor', 'thumbnail', 'author', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions'),
24   - 'permastructure' => array('identifier' => $this->content_type, 'structure' => '%identifier%'.get_option('permalink_structure'))
  24 + 'permastructure' => array('identifier' => $this->content_type, 'structure' => '%identifier%'.get_option('permalink_structure')),
  25 + 'has_archive' => false,
  26 + 'menu_position' => 25
25 27 );
26 28
27 29 $this->settings = array();
@@ -137,6 +139,16 @@ public function get_type_is_public()
137 139 return $this->get_setting('public', true);
138 140 }
139 141
  142 + public function get_type_has_archive()
  143 + {
  144 + return $this->get_setting('has_archive', false);
  145 + }
  146 +
  147 + public function get_type_menu_position()
  148 + {
  149 + return $this->get_setting('menu_position', 25);
  150 + }
  151 +
140 152 public function get_type_is_hierarchical()
141 153 {
142 154 return $this->get_setting('hierarchical', false);
@@ -689,6 +701,14 @@ private function edit_content_type_form($content_handler, $add = true)
689 701 <span class="description"><?php _e('This should almost always be Yes.')?></span>
690 702 </td>
691 703 </tr>
  704 + <tr valign="top">
  705 + <th scope="row"><label for="menu_position"><?php echo 'menu_position'; ?></label></th>
  706 + <td>
  707 + <input type="text" class="regular-text code" id="menu_position" name="menu_position" value="<?php echo esc_attr($content_handler->get_type_menu_position()); ?>" />
  708 + &nbsp; &nbsp;
  709 + <span class="description"><?php echo '5 - below Posts 10 - below Media 15 - below Links 20 - below Pages 25 - below comments ';?></span>
  710 + </td>
  711 + </tr>
692 712 <?php /* @todo leaving these out for now
693 713 <tr valign="top">
694 714 <th scope="row"><?php _e('Is Hierarchical?'); ?></th>
@@ -736,6 +756,18 @@ private function edit_content_type_form($content_handler, $add = true)
736 756 <span class="description"><?php _e('Should this content be excluded in search results?')?></span>
737 757 </td>
738 758 </tr>
  759 + <tr valign="top">
  760 + <th scope="row"><?php echo 'has_archive?'; ?></th>
  761 + <td>
  762 + <label for="has_archive_yes"><?php echo ('Yes') ?></label>
  763 + <input type="radio" id="has_archive" name="has_archive" value="1"<?php echo $content_handler->get_type_has_archive() ? ' checked="checked"' : ''?> />
  764 + &nbsp; &nbsp;
  765 + <label for="has_archive_no"><?php echo ('No') ?></label>
  766 + <input type="radio" id="has_archive" name="has_archive" value="0"<?php echo !$content_handler->get_type_has_archive() ? ' checked="checked"' : ''?> />
  767 + &nbsp; &nbsp;
  768 + <span class="description"><?php echo 'Use custom_post_type_archives?';?></span>
  769 + </td>
  770 + </tr>
739 771 </table>
740 772 <br />
741 773 <h3><?php _e('Permalink Structure')?></h3>
4 cp-custom-content/cp-custom-content-core.php
@@ -103,7 +103,9 @@ public function setup_custom_content()
103 103 'supports'=> $handler->get_type_supports(),
104 104 'rewrite' => $handler->get_type_rewrite(),
105 105 'query_var' => $handler->get_type_query_var(),
106   - 'show_ui' => (bool)$handler->get_type_show_ui()
  106 + 'show_ui' => (bool) $handler->get_type_show_ui(),
  107 + 'has_archive' => (bool) $handler->get_type_has_archive(),
  108 + 'menu_position' => (int) $handler->get_type_menu_position()
107 109 );
108 110
109 111 if($edit_link = $handler->get_type_edit_link())
4 cp-custom-content/cp-custom-content-handler-base.php
@@ -966,6 +966,10 @@ public function get_type_exclude_from_search();
966 966 public function get_type_publicly_queryable();
967 967
968 968 public function get_type_show_ui();
  969 +
  970 + public function get_type_has_archive();
  971 +
  972 + public function get_type_menu_position();
969 973
970 974 /**
971 975 * 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.