• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Easy Digital Downloads a2z

Easy Digital Downloads a2z

Easy Digital Downloads a2z

  • Home
  • Plugins
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / edd_setup_edd_post_types() – Registers and sets up the Downloads custom post type

You appear to be a bot. Output may be restricted

Description

Registers and sets up the Downloads custom post type

Usage

$void = edd_setup_edd_post_types();

Parameters

Returns

void

Source

File name: easy-digital-downloads/includes/post-types.php
Lines:

1 to 100 of 112
function edd_setup_edd_post_types() {

  $archives = defined( 'EDD_DISABLE_ARCHIVE' ) && EDD_DISABLE_ARCHIVE ? false : true;
  $slug     = defined( 'EDD_SLUG' ) ? EDD_SLUG : 'downloads';
  $rewrite  = defined( 'EDD_DISABLE_REWRITE' ) && EDD_DISABLE_REWRITE ? false : array('slug' => $slug, 'with_front' => false);

  $download_labels =  apply_filters( 'edd_download_labels', array(
    'name'                  => _x( '%2$s', 'download post type name', 'easy-digital-downloads' ),
    'singular_name'         => _x( '%1$s', 'singular download post type name', 'easy-digital-downloads' ),
    'add_new'               => __( 'Add New', 'easy-digital-downloads' ),
    'add_new_item'          => __( 'Add New %1$s', 'easy-digital-downloads' ),
    'edit_item'             => __( 'Edit %1$s', 'easy-digital-downloads' ),
    'new_item'              => __( 'New %1$s', 'easy-digital-downloads' ),
    'all_items'             => __( 'All %2$s', 'easy-digital-downloads' ),
    'view_item'             => __( 'View %1$s', 'easy-digital-downloads' ),
    'search_items'          => __( 'Search %2$s', 'easy-digital-downloads' ),
    'not_found'             => __( 'No %2$s found', 'easy-digital-downloads' ),
    'not_found_in_trash'    => __( 'No %2$s found in Trash', 'easy-digital-downloads' ),
    'parent_item_colon'     => '',
    'menu_name'             => _x( '%2$s', 'download post type menu name', 'easy-digital-downloads' ),
    'featured_image'        => __( '%1$s Image', 'easy-digital-downloads' ),
    'set_featured_image'    => __( 'Set %1$s Image', 'easy-digital-downloads' ),
    'remove_featured_image' => __( 'Remove %1$s Image', 'easy-digital-downloads' ),
    'use_featured_image'    => __( 'Use as %1$s Image', 'easy-digital-downloads' ),
    'attributes'            => __( '%1$s Attributes', 'easy-digital-downloads' ),
    'filter_items_list'     => __( 'Filter %2$s list', 'easy-digital-downloads' ),
    'items_list_navigation' => __( '%2$s list navigation', 'easy-digital-downloads' ),
    'items_list'            => __( '%2$s list', 'easy-digital-downloads' ),
  ) );

  foreach ( $download_labels as $key => $value ) {
    $download_labels[ $key ] = sprintf( $value, edd_get_label_singular(), edd_get_label_plural() );
  }

  $download_args = array(
    'labels'             => $download_labels,
    'public'             => true,
    'publicly_queryable' => true,
    'show_ui'            => true,
    'show_in_menu'       => true,
    'query_var'          => true,
    'menu_icon'          => 'dashicons-download',
    'rewrite'            => $rewrite,
    'capability_type'    => 'product',
    'map_meta_cap'       => true,
    'has_archive'        => $archives,
    'hierarchical'       => false,
    'supports'           => apply_filters( 'edd_download_supports', array( 'title', 'editor', 'thumbnail', 'excerpt', 'revisions', 'author' ) ),
  );
  register_post_type( 'download', apply_filters( 'edd_download_post_type_args', $download_args ) );


  
/** Payment Post Type */
  $payment_labels = array(
    'name'               => _x( 'Payments', 'post type general name', 'easy-digital-downloads' ),
    'singular_name'      => _x( 'Payment', 'post type singular name', 'easy-digital-downloads' ),
    'add_new'            => __( 'Add New', 'easy-digital-downloads' ),
    'add_new_item'       => __( 'Add New Payment', 'easy-digital-downloads' ),
    'edit_item'          => __( 'Edit Payment', 'easy-digital-downloads' ),
    'new_item'           => __( 'New Payment', 'easy-digital-downloads' ),
    'all_items'          => __( 'All Payments', 'easy-digital-downloads' ),
    'view_item'          => __( 'View Payment', 'easy-digital-downloads' ),
    'search_items'       => __( 'Search Payments', 'easy-digital-downloads' ),
    'not_found'          => __( 'No Payments found', 'easy-digital-downloads' ),
    'not_found_in_trash' => __( 'No Payments found in Trash', 'easy-digital-downloads' ),
    'parent_item_colon'  => '',
    'menu_name'          => __( 'Payment History', 'easy-digital-downloads' )
  );

  $payment_args = array(
    'labels'          => apply_filters( 'edd_payment_labels', $payment_labels ),
    'public'          => false,
    'query_var'       => false,
    'rewrite'         => false,
    'capability_type' => 'shop_payment',
    'map_meta_cap'    => true,
    'supports'        => array( 'title' ),
    'can_export'      => true
  );
  register_post_type( 'edd_payment', $payment_args );


  
/** Discounts Post Type */
  $discount_labels = array(
    'name'               => _x( 'Discounts', 'post type general name', 'easy-digital-downloads' ),
    'singular_name'      => _x( 'Discount', 'post type singular name', 'easy-digital-downloads' ),
    'add_new'            => __( 'Add New', 'easy-digital-downloads' ),
    'add_new_item'       => __( 'Add New Discount', 'easy-digital-downloads' ),
    'edit_item'          => __( 'Edit Discount', 'easy-digital-downloads' ),
    'new_item'           => __( 'New Discount', 'easy-digital-downloads' ),
    'all_items'          => __( 'All Discounts', 'easy-digital-downloads' ),
    'view_item'          => __( 'View Discount', 'easy-digital-downloads' ),
    'search_items'       => __( 'Search Discounts', 'easy-digital-downloads' ),
    'not_found'          => __( 'No Discounts found', 'easy-digital-downloads' ),
    'not_found_in_trash' => __( 'No Discounts found in Trash', 'easy-digital-downloads' ),
    'parent_item_colon'  => '',
    'menu_name'          => __( 'Discounts', 'easy-digital-downloads' )
  );

  $discount_args = array(
 
[1] [2] Next »

 View on GitHub View on Trac

Published: 26th November 2019 | Last updated: 26th November 2019

Primary Sidebar

Information

Function name: edd_setup_edd_post_types
Plugin ref: Easy Digital Downloads
Version: 2.11.6
Sourcefile: includes/post-types.php
File ref: includes/post-types.php
Deprecated?: No
API Letters: E,P,S,T

Footer

Easy Digital Downloads a2z
Easy Digital Downloads a2z
Easy Digital Downloads a2z
WordPress 5.9.3
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  edd.wp-a2z.org
© Copyright Easy Digital Downloads a2z 2014-2022. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites