Front-End 1

Front-End 1

Business Template

Categories :

Mentor: G M Mostakim Billah

Email: contact@mostakim.com

Note: Post type registrations should not be hooked before the ‘init’ action. Also, any taxonomy connections should be registered via the $taxonomies argument to ensure consistency when hooks such as ‘parse_query’ or ‘pre_get_posts’ are used.

Post types can support any number of built-in core features such as meta boxes, custom fields, post thumbnails, post statuses, comments, and more. See the $supports argument for a complete list of supported features.

$post_type

(string) (Required) Post type key. Must not exceed 20 characters and may only contain lowercase alphanumeric characters, dashes, and underscores. See sanitize_key().$args

(array|string) (Optional) Array or string of arguments for registering a post type.

  • ‘label’
    (string) Name of the post type shown in the menu. Usually plural. Default is value of $labels[‘name’].
  • ‘labels’
    (array) An array of labels for this post type. If not set, post labels are inherited for non-hierarchical types and page labels for hierarchical ones. See get_post_type_labels() for a full list of supported labels.
  • ‘description’
    (string) A short descriptive summary of what the post type is.
  • ‘public’
    (bool) Whether a post type is intended for use publicly either via the admin interface or by front-end users. While the default settings of $exclude_from_search, $publicly_queryable, $show_ui, and $show_in_nav_menus are inherited from public, each does not rely on this relationship and controls a very specific intention. Default false.
  • ‘hierarchical’
    (bool) Whether the post type is hierarchical (e.g. page). Default false.
  • ‘exclude_from_search’
    (bool) Whether to exclude posts with this post type from front end search results. Default is the opposite value of $public.
  • ‘publicly_queryable’
    (bool) Whether queries can be performed on the front end for the post type as part of parse_request(). Endpoints would include:
    * ?post_type={post_type_key}
    * ?{post_type_key}={single_post_slug}
    * ?{post_type_query_var}={single_post_slug} If not set, the default is inherited from $public.
  • ‘show_ui’
    (bool) Whether to generate and allow a UI for managing this post type in the admin. Default is value of $public.
  • ‘show_in_menu’
    (bool|string) Where to show the post type in the admin menu. To work, $show_ui must be true. If true, the post type is shown in its own top level menu. If false, no menu is shown. If a string of an existing top level menu (eg. ‘tools.php’ or ‘edit.php?post_type=page’), the post type will be placed as a sub-menu of that. Default is value of $show_ui.
  • ‘show_in_nav_menus’
    (bool) Makes this post type available for selection in navigation menus. Default is value of $public.
  • ‘show_in_admin_bar’
    (bool) Makes this post type available via the admin bar. Default is value of $show_in_menu.

Post types can support any number of built-in core features such as meta boxes, custom fields, post thumbnails, post statuses, comments, and more. See the $supports argument for a complete list of supported features.

Close Menu