Changeset 9090
- Timestamp:
- 08/05/2019 02:42:57 AM (5 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/support-helphub/inc/helphub-post-types/classes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-helphub/inc/helphub-post-types/classes/class-helphub-post-types-post-type.php
r8079 r9090 33 33 34 34 /** 35 * The slug used in URLs for the post type items. 36 * 37 * @access public 38 * @since 1.0.0 39 * @var string 40 */ 41 public $single_slug; 42 43 /** 44 * The slug used in URLs for the archive of the post type. 45 * 46 * @access public 47 * @since 1.0.0 48 * @var string 49 */ 50 public $archive_slug; 51 52 /** 35 53 * The post type singular label. 36 54 * … … 78 96 * @param string $plural The plural pronunciation of the post type name. 79 97 * @param array $args The typical arguments allowed to register a post type. 98 * @param string $single_slug The 'singular' slug for the post type. 99 * @param string $archive_slug The 'archive' slug for the post type. 80 100 * @param array $taxonomies The list of taxonomies that the post type is associated with. 81 101 */ 82 public function __construct( $post_type = 'thing', $singular = '', $plural = '', $args = array(), $taxonomies = array() ) {102 public function __construct( $post_type = 'thing', $singular = '', $plural = '', $args = array(), $taxonomies = array(), $single_slug = false, $archive_slug = false ) { 83 103 $this->post_type = $post_type; 84 104 $this->singular = $singular; … … 86 106 $this->args = $args; 87 107 $this->taxonomies = $taxonomies; 108 109 if ( ! $single_slug ) { 110 $single_slug = sanitize_title_with_dashes( $this->singular ); 111 } 112 $this->single_slug = apply_filters( 'helphub_single_slug', $single_slug ); 113 114 if ( ! $archive_slug ) { 115 $archive_slug = sanitize_title_with_dashes( $this->plural ); 116 } 117 $this->archive_slug = apply_filters( 'helphub_archive_slug', $archive_slug ); 88 118 89 119 add_action( 'init', array( $this, 'register_post_type' ) ); … … 148 178 ); 149 179 150 $single_slug = apply_filters( 'helphub_single_slug', sanitize_title_with_dashes( $this->singular ) );151 $archive_slug = apply_filters( 'helphub_archive_slug', sanitize_title_with_dashes( $this->plural ) );152 153 180 $defaults = array( 154 181 'labels' => $labels, … … 159 186 'query_var' => true, 160 187 'rewrite' => array( 161 'slug' => $ single_slug,188 'slug' => $this->single_slug, 162 189 ), 163 190 'capability_type' => 'post', 164 'has_archive' => $ archive_slug,191 'has_archive' => $this->archive_slug, 165 192 'hierarchical' => false, 166 193 'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', 'page-attributes', 'revisions' ), … … 168 195 'menu_icon' => 'dashicons-smiley', 169 196 'show_in_rest' => true, 170 'rest_base' => $ archive_slug,197 'rest_base' => $this->archive_slug, 171 198 'rest_controller_class' => 'WP_REST_Posts_Controller', 172 199 ); -
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-helphub/inc/helphub-post-types/classes/class-helphub-post-types.php
r7354 r9090 128 128 129 129 $this->post_types['post'] = new HelpHub_Post_Types_Post_Type( 130 'post', __( 'Post', 'wporg-forums' ), __( 'Posts', 'wporg-forums' ), array( 130 'post', 131 __( 'Post', 'wporg-forums' ), 132 __( 'Posts', 'wporg-forums' ), 133 array( 131 134 'menu_icon' => 'dashicons-post', 132 ) 135 ), 136 array(), 137 'post', 138 'posts' 133 139 ); 134 140 $this->post_types['helphub_article'] = new HelpHub_Post_Types_Post_Type( 135 'helphub_article', __( 'Article', 'wporg-forums' ), __( 'Articles', 'wporg-forums' ), array( 141 'helphub_article', 142 __( 'Article', 'wporg-forums' ), 143 __( 'Articles', 'wporg-forums' ), 144 array( 136 145 'menu_icon' => 'dashicons-media-document', 137 ) 146 ), 147 array(), 148 'article', 149 'articles' 138 150 ); 139 151 $this->post_types['helphub_version'] = new HelpHub_Post_Types_Post_Type( 140 'helphub_version', __( 'WordPress Version', 'wporg-forums' ), __( 'WordPress Versions', 'wporg-forums' ), array( 152 'helphub_version', 153 __( 'WordPress Version', 'wporg-forums' ), 154 __( 'WordPress Versions', 'wporg-forums' ), 155 array( 141 156 'menu_icon' => 'dashicons-wordpress', 142 ) 157 ), 158 array(), 159 'wordpress-version', 160 'wordpress-versions' 143 161 ); 144 162
Note: See TracChangeset
for help on using the changeset viewer.