cptui_render_getcode_section

Content for the Get Code tab.

Description

cptui_render_getcode_section(); 

Usage

  1. if ( !function_exists( 'cptui_render_getcode_section' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'custom-post-type-ui/inc/tools.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = cptui_render_getcode_section(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/inc/tools.php  
  1. function cptui_render_getcode_section() { 
  2. ?> 
  3. <h1><?php _e( 'Get Post Type and Taxonomy Code', 'custom-post-type-ui' ); ?></h1> 
  4.  
  5. <h2><?php _e( 'All CPT UI Post Types', 'custom-post-type-ui' ); ?></h2> 
  6.  
  7. <p><?php esc_html_e( 'All of the selectable code snippets below are useful if you wish to migrate away from CPTUI and retain your existing registered post types or taxonomies.', 'custom-post-type-ui' ); ?></p> 
  8.  
  9. <?php $cptui_post_types = cptui_get_post_type_data(); ?> 
  10. <label for="cptui_post_type_get_code"><?php _e( 'Copy/paste the code below into your functions.php file.', 'custom-post-type-ui' ); ?></label> 
  11. <textarea name="cptui_post_type_get_code" id="cptui_post_type_get_code" class="cptui_post_type_get_code" onclick="this.focus();this.select()" onfocus="this.focus();this.select();" readonly="readonly" aria-readonly="true"><?php cptui_get_post_type_code( $cptui_post_types ); ?></textarea> 
  12.  
  13. <?php 
  14. if ( ! empty( $cptui_post_types ) ) { 
  15. foreach ( $cptui_post_types as $post_type ) { ?> 
  16. <h2 id="<?php echo esc_attr( $post_type['name'] ); ?>"><?php 
  17. $type = ( ! empty( $post_type['label'] ) ) ? $post_type['label'] : $post_type['name']; 
  18. printf( __( '%s Post Type', 'custom-post-type-ui' ), $type ); ?></h2> 
  19. <label for="cptui_post_type_get_code_<?php echo $post_type['name']; ?>"><?php _e( 'Copy/paste the code below into your functions.php file.', 'custom-post-type-ui' ); ?></label> 
  20. <textarea name="cptui_post_type_get_code_<?php echo $post_type['name']; ?>" id="cptui_post_type_get_code_<?php echo $post_type['name']; ?>" class="cptui_post_type_get_code" onclick="this.focus();this.select()" onfocus="this.focus();this.select();" readonly="readonly" aria-readonly="true"><?php cptui_get_post_type_code( array( $post_type ), true ); ?></textarea> 
  21. <?php } 
  22. } ?> 
  23.  
  24. <h2><?php _e( 'All CPT UI Taxonomies', 'custom-post-type-ui' ); ?></h2> 
  25.  
  26. <?php $cptui_taxonomies = cptui_get_taxonomy_data(); ?> 
  27. <label for="cptui_tax_get_code"><?php _e( 'Copy/paste the code below into your functions.php file.', 'custom-post-type-ui' ); ?></label> 
  28. <textarea name="cptui_tax_get_code" id="cptui_tax_get_code" class="cptui_tax_get_code" onclick="this.focus();this.select()" onfocus="this.focus();this.select();" readonly="readonly" aria-readonly="true"><?php cptui_get_taxonomy_code( $cptui_taxonomies ); ?></textarea> 
  29.  
  30. <?php 
  31. if ( ! empty( $cptui_taxonomies ) ) { 
  32. foreach ( $cptui_taxonomies as $taxonomy ) { ?> 
  33. <h2 id="<?php echo esc_attr( $taxonomy['name'] ); ?>"><?php 
  34. $tax = ( ! empty( $taxonomy['label'] ) ) ? $taxonomy['label'] : $taxonomy['name']; 
  35. printf( __( '%s Taxonomy', 'custom-post-type-ui' ), $tax ); ?></h2> 
  36. <label for="cptui_tax_get_code_<?php echo $taxonomy['name']; ?>"><?php _e( 'Copy/paste the code below into your functions.php file.', 'custom-post-type-ui' ); ?></label> 
  37. <textarea name="cptui_tax_get_code_<?php echo $taxonomy['name']; ?>" id="cptui_tax_get_code_<?php echo $taxonomy['name']; ?>" class="cptui_tax_get_code" onclick="this.focus();this.select()" onfocus="this.focus();this.select();" readonly="readonly" aria-readonly="true"><?php cptui_get_taxonomy_code( array( $taxonomy ), true ); ?></textarea> 
  38. <?php } 
  39. } ?> 
  40. <?php