Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. <?php
  2.  
  3. // Styling for the custom post type icon
  4. add_action( 'admin_head', 'wp_video_icon' );
  5.  
  6. function wp_video_icon() {
  7. ?>
  8. <style type="text/css" media="screen">
  9. #icon-edit.icon32-posts-video {background: url(<?php bloginfo('template_directory'); ?>/images/video-32.png) no-repeat;}
  10. </style>
  11. <?php }
  12.  
  13.  
  14. /*-----------------------------------------------------------------------------------*/
  15. /* Register Video custom post types
  16. /*-----------------------------------------------------------------------------------*/
  17.  
  18. function wpzoom_create_post_type_videos()
  19. {
  20. $labels = array(
  21. 'name' => _x( 'Videos', 'post type general name', 'wpzoom'),
  22. 'singular_name' => _x( 'Video', 'post type general name', 'wpzoom'),
  23. 'rewrite' => array('slug' => 'video' ),
  24. 'add_new' => _x('Add New', 'video', 'wpzoom'),
  25. 'add_new_item' => __('Add New Video', 'wpzoom'),
  26. 'edit_item' => __('Edit Videos', 'wpzoom'),
  27. 'new_item' => __('New Videos', 'wpzoom'),
  28. 'view_item' => __('View Video', 'wpzoom'),
  29. 'search_items' => __('Search Videos', 'wpzoom'),
  30. 'not_found' => __('No videos found', 'wpzoom'),
  31. 'not_found_in_trash' => __('No videos found in Trash', 'wpzoom'),
  32. 'parent_item_colon' => ''
  33. );
  34.  
  35. $args = array(
  36. 'labels' => $labels,
  37. 'public' => true,
  38. 'publicly_queryable' => true,
  39. 'show_ui' => true,
  40. 'query_var' => true,
  41. 'rewrite' => true,
  42. 'capability_type' => 'post',
  43. 'hierarchical' => false,
  44. 'rewrite' => array( "slug" => "video" ),
  45. 'menu_position' => null,
  46. 'show_in_nav_menus' => true ,
  47. 'has_archive' => true,
  48. 'menu_icon' => get_template_directory_uri() .'/images/video2.png', // 16px16
  49. 'supports' => array('title', 'editor', 'excerpt', 'comments', 'thumbnail'),
  50. 'taxonomies' => array( 'videos')
  51. );
  52.  
  53. register_post_type('video' ,$args);
  54. }
  55.  
  56. add_action( 'init', 'wpzoom_create_post_type_videos' );
  57.  
  58.  
  59.  
  60.  
  61. /*
  62. /* Create custom taxonomies for the portfolio post type
  63. ==============================================================*/
  64.  
  65. function wpzoom_build_taxonomies(){
  66. register_taxonomy(__( "videos" ),
  67. array(__( "video" )),
  68. array( "hierarchical" => true,
  69. "label" => __( "Video Categories" ),
  70. "singular_label" => __( "Video Category" ),
  71. 'public' => true,
  72. 'show_ui' => true,
  73. "rewrite" => array(
  74. 'slug' => 'videos',
  75. 'hierarchical' => true
  76. )));
  77. }
  78.  
  79. add_action( 'init', 'wpzoom_build_taxonomies', 0 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement