Advertisement
Guest User

Untitled

a guest
Dec 17th, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.71 KB | None | 0 0
  1. <?php
  2. // overschrijf parent style CSS
  3. add_action( 'wp_enqueue_scripts', 'gmm_enqueue_styles' );
  4. function gmm_enqueue_styles() {
  5. $parent_style = 'parent-style'; // This is 'twentyfifteen-style' for the Twenty Fifteen theme.
  6. wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
  7. wp_enqueue_style( 'child-style',
  8. get_stylesheet_directory_uri() . '/screen.css',
  9. array( $parent_style ),
  10. wp_get_theme()->get('Version')
  11. );
  12. }
  13.  
  14.  
  15.  
  16. //aanmaken custom post type actors
  17. if ( ! function_exists('gmm_actors') ) {
  18. // Register Custom Post Type
  19. function gmm_actors() {
  20. $labels = array(
  21. 'name' => 'Actors',
  22. 'singular_name' => 'Actor',
  23. 'menu_name' => 'Actors',
  24. 'name_admin_bar' => 'Actors',
  25. 'archives' => 'Actors',
  26. 'attributes' => 'Actors Attributes',
  27. 'parent_item_colon' => 'Parent Item:',
  28. 'all_items' => 'All Items',
  29. 'add_new_item' => 'Add new actor',
  30. 'add_new' => 'New Actor',
  31. 'new_item' => 'New Actor',
  32. 'edit_item' => 'Edit Actor',
  33. 'update_item' => 'Update Actor',
  34. 'view_item' => 'View Actor',
  35. 'view_items' => 'View Actors',
  36. 'search_items' => 'Search Actors',
  37. 'not_found' => 'Not found',
  38. 'not_found_in_trash' => 'Not found in Trash',
  39. 'featured_image' => 'Featured Image',
  40. 'set_featured_image' => 'Set featured image',
  41. 'remove_featured_image' => 'Remove featured image',
  42. 'use_featured_image' => 'Use as featured image',
  43. 'insert_into_item' => 'Insert into item',
  44. 'uploaded_to_this_item' => 'Uploaded to this item',
  45. 'items_list' => 'Actors list',
  46. 'items_list_navigation' => 'Actors list navigation',
  47. 'filter_items_list' => 'Filter Actors list',
  48. );
  49. $args = array(
  50. 'label' => 'Actor',
  51. 'description' => 'Actors & Cast members',
  52. 'labels' => $labels,
  53. 'supports' => array( 'title', 'editor', 'thumbnail', 'revisions' ),
  54. 'hierarchical' => false,
  55. 'public' => true,
  56. 'show_ui' => true,
  57. 'show_in_menu' => true,
  58. 'menu_position' => 5,
  59. 'menu_icon' => 'dashicons-universal-access-alt',
  60. 'show_in_admin_bar' => true,
  61. 'show_in_nav_menus' => true,
  62. 'can_export' => true,
  63. 'has_archive' => true,
  64. 'exclude_from_search' => false,
  65. 'publicly_queryable' => true,
  66. 'capability_type' => 'page',
  67. );
  68. register_post_type( 'actors', $args );
  69. }
  70. add_action( 'init', 'gmm_actors', 0 );
  71. }
  72.  
  73.  
  74.  
  75. //aanmaken custom post type series
  76. if ( ! function_exists('gmm_series') ) {
  77. // Register Custom Post Type
  78. function gmm_series() {
  79. $labels = array(
  80. 'name' => 'Series',
  81. 'singular_name' => 'Serie',
  82. 'menu_name' => 'Series',
  83. 'name_admin_bar' => 'Series',
  84. 'archives' => 'Series',
  85. 'attributes' => 'Series Attributes',
  86. 'parent_item_colon' => 'Parent Item:',
  87. 'all_items' => 'All Items',
  88. 'add_new_item' => 'Add new serie',
  89. 'add_new' => 'New Serie',
  90. 'new_item' => 'New Serie',
  91. 'edit_item' => 'Edit Serie',
  92. 'update_item' => 'Update Serie',
  93. 'view_item' => 'View Serie',
  94. 'view_items' => 'View Series',
  95. 'search_items' => 'Search Series',
  96. 'not_found' => 'Not found',
  97. 'not_found_in_trash' => 'Not found in Trash',
  98. 'featured_image' => 'Featured Image',
  99. 'set_featured_image' => 'Set featured image',
  100. 'remove_featured_image' => 'Remove featured image',
  101. 'use_featured_image' => 'Use as featured image',
  102. 'insert_into_item' => 'Insert into item',
  103. 'uploaded_to_this_item' => 'Uploaded to this item',
  104. 'items_list' => 'Series list',
  105. 'items_list_navigation' => 'Series list navigation',
  106. 'filter_items_list' => 'Filter Series list',
  107. );
  108. $args = array(
  109. 'label' => 'Serie',
  110. 'description' => 'Series',
  111. 'labels' => $labels,
  112. 'supports' => array( 'title', 'editor', 'thumbnail', 'revisions' ),
  113. 'hierarchical' => false,
  114. 'public' => true,
  115. 'show_ui' => true,
  116. 'show_in_menu' => true,
  117. 'menu_position' => 5,
  118. 'menu_icon' => 'dashicons-video-alt3',
  119. 'show_in_admin_bar' => true,
  120. 'show_in_nav_menus' => true,
  121. 'can_export' => true,
  122. 'has_archive' => true,
  123. 'exclude_from_search' => false,
  124. 'publicly_queryable' => true,
  125. 'capability_type' => 'page',
  126. 'show_in_rest' => true,
  127. );
  128. register_post_type( 'series', $args );
  129.  
  130. }
  131. add_action( 'init', 'gmm_series', 0 );
  132. }
  133.  
  134.  
  135.  
  136. //aanmaken custom post type Episodes
  137. if ( ! function_exists('Episodes') ) {
  138. // Register Custom Post Type
  139. function Episodes() {
  140. $labels = array(
  141. 'name' => _x( 'Episodes', 'Post Type General Name', 'text_domain' ),
  142. 'singular_name' => _x( 'Episode', 'Post Type Singular Name', 'text_domain' ),
  143. 'menu_name' => __( 'Episodes', 'text_domain' ),
  144. 'name_admin_bar' => __( 'Episodes', 'text_domain' ),
  145. 'archives' => __( 'Episodes archief', 'text_domain' ),
  146. 'attributes' => __( 'Episode Attributes', 'text_domain' ),
  147. 'parent_item_colon' => __( 'Parent Item:', 'text_domain' ),
  148. 'all_items' => __( 'All Items', 'text_domain' ),
  149. 'add_new_item' => __( 'Add New episode', 'text_domain' ),
  150. 'add_new' => __( 'New Episode', 'text_domain' ),
  151. 'new_item' => __( 'New Episode', 'text_domain' ),
  152. 'edit_item' => __( 'Edit Episode', 'text_domain' ),
  153. 'update_item' => __( 'Update Episode', 'text_domain' ),
  154. 'view_item' => __( 'View Episode', 'text_domain' ),
  155. 'view_items' => __( 'View Episodes', 'text_domain' ),
  156. 'search_items' => __( 'Search Episode', 'text_domain' ),
  157. 'not_found' => __( 'Not found', 'text_domain' ),
  158. 'not_found_in_trash' => __( 'Not found in Trash', 'text_domain' ),
  159. 'featured_image' => __( 'Featured Image', 'text_domain' ),
  160. 'set_featured_image' => __( 'Set featured image', 'text_domain' ),
  161. 'remove_featured_image' => __( 'Remove featured image', 'text_domain' ),
  162. 'use_featured_image' => __( 'Use as featured image', 'text_domain' ),
  163. 'insert_into_item' => __( 'Insert into item', 'text_domain' ),
  164. 'uploaded_to_this_item' => __( 'Uploaded to this item', 'text_domain' ),
  165. 'items_list' => __( 'Episodes list', 'text_domain' ),
  166. 'items_list_navigation' => __( 'Episodes list navigation', 'text_domain' ),
  167. 'filter_items_list' => __( 'Filter Episodes list', 'text_domain' ),
  168. );
  169. $args = array(
  170. 'label' => __( 'Episode', 'text_domain' ),
  171. 'description' => __( 'Episodes (series)', 'text_domain' ),
  172. 'labels' => $labels,
  173. 'supports' => array( 'title', 'editor', 'thumbnail', 'revisions'),
  174. 'taxonomies' => array( 'category', 'post_tag' ),
  175. 'hierarchical' => false,
  176. 'public' => true,
  177. 'show_ui' => true,
  178. 'show_in_menu' => true,
  179. 'menu_position' => 5,
  180. 'menu_icon' => 'dashicons-video-alt2',
  181. 'show_in_admin_bar' => true,
  182. 'show_in_nav_menus' => true,
  183. 'can_export' => true,
  184. 'has_archive' => true,
  185. 'exclude_from_search' => false,
  186. 'publicly_queryable' => true,
  187. 'capability_type' => 'page',
  188. 'show_in_rest' => true,
  189. );
  190. register_post_type( 'Episodes', $args );
  191.  
  192. }
  193. add_action( 'init', 'Episodes', 0 );
  194. }
  195.  
  196.  
  197.  
  198. //aanmaken alle custom velden
  199. function gmm_add_custom_box(){
  200. add_meta_box(
  201. 'gmm_actor_box_id', // Unique ID
  202. 'Actor Info', // Box title
  203. 'gmm_custom_box_Actors_html', // Content callback, must be of type callable
  204. 'Actors' // Post type
  205. );
  206. add_meta_box(
  207. 'gmm_serie_box_id', // Unique ID
  208. 'Serie Info', // Box title
  209. 'gmm_custom_box_Series_html', // Content callback, must be of type callable
  210. 'Series' // Post type
  211. );
  212. add_meta_box(
  213. 'gmm_episode_box_id', // Unique ID
  214. 'Episode Info', // Box title
  215. 'gmm_custom_box_Episode_html', // Content callback, must be of type callable
  216. 'Episodes' // Post type
  217. );
  218. add_meta_box(
  219. 'gmm_episodeSerie_box_id', // Unique ID
  220. 'Serie select', // Box title
  221. 'gmm_custom_box_EpisodeSerie_html', // Content callback, must be of type callable
  222. 'Episodes' // Post type
  223. );
  224. add_meta_box(
  225. 'gmm_EpisodeActor_box_id', // Unique ID
  226. 'Actor select', // Box title
  227. 'gmm_custom_box_EpisodeActor_html', // Content callback, must be of type callable
  228. 'Episodes' // Post type
  229. );
  230. }
  231.  
  232.  
  233.  
  234. //Genereren custom velden Series
  235. function gmm_custom_box_Series_html($post){
  236. $value_Start = get_post_meta($post->ID, '_start', true);
  237. if($value_Start == NULL){$value_Start = "Unknown year";}
  238. $value_End = get_post_meta($post->ID, '_end', true);
  239. if($value_End == NULL){$value_End = "Present";}
  240. $value_Seasons = get_post_meta($post->ID, '_seasons', true);
  241. if($value_Seasons == NULL){$value_Seasons = "Unknown";}
  242. $value_Language = get_post_meta($post->ID, '_language', true);
  243. if($value_Language == NULL){$value_Language = "Unknown";}
  244. $value_Subtitles = get_post_meta($post->ID, '_subtitles', true);
  245. if($value_Subtitles == NULL){$value_Subtitles = "Unknown";}
  246. $value_ImageFormat = get_post_meta($post->ID, '_imageFormat', true);
  247. if($value_ImageFormat == NULL){$value_ImageFormat = "Unknown";}
  248. $value_ProductionHouse = get_post_meta($post->ID, '_productionHouse', true);
  249. if($value_ProductionHouse == NULL){$value_ProductionHouse = "Unknown";}
  250. $value_VieuwerGuide = get_post_meta($post->ID, '_vieuwerGuide', true);
  251. if($value_VieuwerGuide == NULL){$value_VieuwerGuide = "No vieuwer guide";}
  252. $value_Format = get_post_meta($post->ID, '_format', true);
  253. if($value_Format == NULL){$value_Format = "Unknown";}
  254. $value_Genre = get_post_meta($post->ID, '_genre', true);
  255. if($value_Genre == NULL){$value_Genre = "Genre Unknown";}
  256.  
  257. print("<div>");
  258. print("Serie year start: ");
  259. print("<input type='number' id='start' name='start' value='". $value_Start . "'");
  260. print("</div>");
  261. print("<br/>");
  262. print("<br/>");
  263.  
  264. print("<div>");
  265. print("Serie year End: ");
  266. print("<input type='number' id='end' name='end' value='". $value_End . "'");
  267. print("</div>");
  268. print("<br/>");
  269. print("<br/>");
  270.  
  271. print("<div>");
  272. print("Season amount: ");
  273. print("<input type='number' id='seasons' name='seasons' value='". $value_Seasons . "'");
  274. print("</div>");
  275. print("<br/>");
  276. print("<br/>");
  277.  
  278. print("<div>");
  279. print("Spoken language: ");
  280. print("<input type='text' id='language' name='language' value='". $value_Language . "'");
  281. print("</div>");
  282. print("<br/>");
  283. print("<br/>");
  284.  
  285. print("<div>");
  286. print("Subtitles: ");
  287. print("<input type='checkbox' name='subtitles' value='true' ". ($value_Subtitles == 'true' ? "checked": "") . " id='subtitles'/>");
  288. print("</div>");
  289. print("<br/>");
  290. print("<br/>");
  291.  
  292. print("<div>");
  293. print("Image format: ");
  294. print("<input type='text' id='imageFormat' name='imageFormat' value='". $value_ImageFormat . "'");
  295. print("</div>");
  296. print("<br/>");
  297. print("<br/>");
  298.  
  299. print("<div>");
  300. print("Production house: ");
  301. print("<input type='text' id='productionHouse' name='productionHouse' value='". $value_ProductionHouse . "'");
  302. print("</div>");
  303. print("<br/>");
  304. print("<br/>");
  305.  
  306. print("<div>");
  307. print("Vieuwer guide (age): ");
  308. print("<input type='text' name = vieuwerGuide id='vieuwerGuide' value='" . $value_VieuwerGuide . "'/>");
  309. print("</div>");
  310. print("<br/>");
  311.  
  312. print("<div>");
  313. print("Select Format: ");
  314. print("<select name ='format' id='format'>");
  315. print("<option value='Clip' ".($value_Format == 'Clip' ? 'selected':"" ).">Clip</option>");
  316. print("<option value='Docufiction' ".($value_Format == 'Docufiction' ? 'selected':"" ).">Docufiction</option>");
  317. print("<option value='Documentary' ".($value_Format == 'Documentary' ? 'selected':"" ).">Documentary</option>");
  318. print("<option value='Single episode' ".($value_Format == 'Single episode' ? 'selected':"" ).">Single episode</option>");
  319. print("<option value='Made-for-TV film' ".($value_Format == 'Made-for-TV film' ? 'selected':"" ).">Made-for-TV film</option>");
  320. print("<option value='Franchise' ".($value_Format == 'Franchise' ? 'selected':"" ).">Franchise</option>");
  321. print("<option value='Mini-episode' ".($value_Format == 'Mini-episode' ? 'selected':"" ).">Mini-episode</option>");
  322. print("<option value='Mini-serie' ".($value_Format == 'Mini-serie' ? 'selected':"" ).">Mini-serie</option>");
  323. print("<option value='Micro-serie' ".($value_Format == 'Micro-serie' ? 'selected':"" ).">Micro-serie</option>");
  324. print("<option value='Mockumentary' ".($value_Format == 'Mockumentary' ? 'selected':"" ).">Mockumentary</option>");
  325. print("<option value='Pilot' ".($value_Format == 'Pilot' ? 'selected':"" ).">Pilot</option>");
  326. print("<option value='Prequel' ".($value_Format == 'Prequel' ? 'selected':"" ).">Prequel</option>");
  327. print("<option value='Reboot' ".($value_Format == 'Reboot' ? 'selected':"" ).">Reboot</option>");
  328. print("<option value='Remake' ".($value_Format == 'Remake' ? 'selected':"" ).">Remake</option>");
  329. print("<option value='Segment' ".($value_Format == 'Segment' ? 'selected':"" ).">Segment</option>");
  330. print("<option value='Sequel' ".($value_Format == 'Sequel' ? 'selected':"" ).">Sequel</option>");
  331. print("<option value='Serial' ".($value_Format == 'Serial' ? 'selected':"" ).">Serial</option>");
  332. print("<option value='Show' ".($value_Format == 'Show' ? 'selected':"" ).">Show</option>");
  333. print("<option value='Special' ".($value_Format == 'Special' ? 'selected':"" ).">Special</option>");
  334. print("<option value='Spin-off' ".($value_Format == 'Spin-off' ? 'selected':"" ).">Spin-off</option>");
  335. print("<option value='unaired episode' ".($value_Format == 'unaired episode' ? 'selected':"" ).">unaired episode/pilot</option>");
  336. print("</select>");
  337. print("</div>");
  338. print("<br/>");
  339.  
  340. print("<div>");
  341. print("Select Genre: ");
  342. print("<select name ='genre' id='genre'>");
  343. print("<option value='Absurdist' ".($value_Genre == "Absurdist" ? 'selected':"" ).">Absurdist/surreal/whimsical</option>");
  344. print("<option value='Action' ".($value_Genre == "Action" ? 'selected':"" ).">Action</option>");
  345. print("<option value='Adventure' ".($value_Genre == "Adventure" ? 'selected':"" ).">Adventure</option>");
  346. print("<option value='Comedy' ".($value_Genre == "Comedy" ? 'selected':"" ).">Comedy</option>");
  347. print("<option value='Crime' ".($value_Genre == "Crime" ? 'selected':"" ).">Crime</option>");
  348. print("<option value='Drama' ".($value_Genre == "Drama" ? 'selected':"" ).">Drama</option>");
  349. print("<option value='Fantasy' ".($value_Genre == "Fantasy" ? 'selected':"" ).">Fantasy</option>");
  350. print("<option value='Historical' ".($value_Genre == "Historical" ? 'selected':"" ).">Historical</option>");
  351. print("<option value='Historical Fiction' ".($value_Genre == "Historical Fiction" ? 'selected':"" ).">Historical Fiction</option>");
  352. print("<option value='Horror' ".($value_Genre == "Horror" ? 'selected':"" ).">Horror</option>");
  353. print("<option value='Magical realism' ".($value_Genre == "Magical realism" ? 'selected':"" ).">Magical realism</option>");
  354. print("<option value='Mystery' ".($value_Genre == "Mystery" ? 'selected':"" ).">Mystery</option>");
  355. print("<option value='Paranoid Fiction' ".($value_Genre == "Paranoid Fiction" ? 'selected':"" ).">Paranoid Fiction</option>");
  356. print("<option value='Philosophical' ".($value_Genre == "Philosophical" ? 'selected':"" ).">Philosophical</option>");
  357. print("<option value='Political' ".($value_Genre == "Political" ? 'selected':"" ).">Political</option>");
  358. print("<option value='Romance' ".($value_Genre == "Romance" ? 'selected':"" ).">Romance</option>");
  359. print("<option value='Saga' ".($value_Genre == "Saga" ? 'selected':"" ).">Saga</option>");
  360. print("<option value='Satire' ".($value_Genre == "Satire" ? 'selected':"" ).">Satire</option>");
  361. print("<option value='Science fiction' ".($value_Genre == "Science fiction" ? 'selected':"" ).">Science fiction</option>");
  362. print("<option value='Social' ".($value_Genre == "Social" ? 'selected':"" ).">Social</option>");
  363. print("<option value='Speculative' ".($value_Genre == "Speculative" ? 'selected':"" ).">Speculative</option>");
  364. print("<option value='Thriller' ".($value_Genre == "Thriller" ? 'selected':"" ).">Thriller</option>");
  365. print("<option value='Urban' ".($value_Genre == "Urban" ? 'selected':"" ).">Urban</option>");
  366. print("<option value='Western' ".($value_Genre == "Western" ? 'selected':"" ).">Western</option>");
  367. print("</select>");
  368. print("</div>");
  369. print("<br/>");
  370. }
  371.  
  372. function gmm_custom_box_EpisodeActor_html($post){
  373. print("<div>");
  374. $actors = get_all_of_post_type('Actors');
  375. foreach($actors as $actor){
  376. print("<div>");
  377. // print("<label>" . $actor . "</label>");
  378. print_r($actor->post_title . ": ");
  379. print("<input type='checkbox' name='actors' value='" . $actor->ID . "' ". ($value_Actor == 'true' ? "checked": "") . " id='actors'/>");
  380. print("</div>");
  381. }
  382. print("</div>");
  383. }
  384.  
  385.  
  386.  
  387. //Genereren custom velden Episodes (post meta)
  388. function gmm_custom_box_Episode_html($post){
  389. $value_ReleaseDate = get_post_meta($post->ID, '_episodeRelease', true);
  390. $value_EpisodeNumber = get_post_meta($post->ID, '_episodeNumber', true);
  391. $value_EpisodeTime = get_post_meta($post->ID, '_episodeTime', true);
  392. print("<div>");
  393. print("Release Date: ");
  394. print("<input type='date' id='episodeRelease' name='episodeRelease' value='". $value_ReleaseDate . "'");
  395. print("</div>");
  396. print("<br/>");
  397. print("<br/>");
  398.  
  399. print("<div>");
  400. print("Episode number: ");
  401. print("<input type='number' id='episodeNumber' name='episodeNumber' value='". $value_EpisodeNumber . "'");
  402. print("</div>");
  403. print("<br/>");
  404. print("<br/>");
  405.  
  406. print("<div>");
  407. print("Episode time (minutes): ");
  408. print("<input type='number' id='episodeTime' name='episodeTime' value='". $value_EpisodeTime . "'");
  409. print("</div>");
  410. print("<br/>");
  411. print("<br/>");
  412. }
  413.  
  414.  
  415. //Genereren custom velden episodes (linked serie)
  416. function gmm_custom_box_EpisodeSerie_html($post){
  417. $connectedSerieID = get_post_meta($post->ID, '_connectedSerieID', true);
  418. $connectedSerieTitle = get_post_meta($post->ID, '_connectedSerieTitle', true);
  419. $value_ConnectedSeason = get_post_meta($post->ID, '_connectedSeason', true);
  420. $series = get_all_of_post_type('Series');
  421.  
  422. print("<div>");
  423. print("Serie: ");
  424. print("<select name='connectedSerieID'>");
  425. foreach($series as $serie){
  426. print("<option name='connectedSerieID' value='" . $serie->ID . "' " . ($serie->ID == $connectedSerieID ? "selected":"") . ">");
  427. print($serie->post_title . "</option>");
  428. }
  429. print("</select>");
  430. print("</div>");
  431. print("<br/>");
  432.  
  433. print("<div>");
  434. print("Season select: ");
  435. print("<input type='text' list='seasons' name='connectedSeason' id='connectedSeason' value='" . $value_ConnectedSeason . "'/>");
  436. print("<datalist id='seasons'>");
  437. print("<option></option>");
  438. print("</datalist>");
  439. print("</div>");
  440. print("<br/>");
  441. }
  442.  
  443.  
  444.  
  445. //aanmaken custom velden bij Actors
  446. function gmm_custom_box_Actors_html($post){
  447. $value_FirstName = get_post_meta($post->ID, '_actorFirstName', true);
  448. $value_LastName = get_post_meta($post->ID, '_actorLastName', true);
  449. $value_Nationality = get_post_meta($post->ID, '_actorNationality', true);
  450. $value_BirthDate = get_post_meta($post->ID, '_actorBirthDate', true);
  451. $value_TwitterAdress = get_post_meta($post->ID, '_actorTwitterAdress', true);
  452. $value_Gender = get_post_meta($post->ID, '_actorGender', true);
  453. $value_Type = get_post_meta($post->ID, '_actorType', true);
  454.  
  455. print("<div>");
  456. print("First Name: ");
  457. print("<input type='text' id='actorFirstName' name='actorFirstName' value='$value_FirstName'>");
  458. print("</div>");
  459. print("<br/>");
  460. print("<br/>");
  461.  
  462. print("<div>");
  463. print("Last Name: ");
  464. print("<input type='text' id='actorLastName' name='actorLastName' value='$value_LastName'>");
  465. print("</div>");
  466. print("<br/>");
  467. print("<br/>");
  468.  
  469. print("<div>");
  470. print("Nationality: ");
  471. print("<input type='text' id='actorNationality' name='actorNationality' value='$value_Nationality'>");
  472. print("</div>");
  473. print("<br/>");
  474. print("<br/>");
  475.  
  476. print("<div>");
  477. print("Birth date: ");
  478. print("<input type='date' id='actorBirthDate' name='actorBirthDate' value='$value_BirthDate'>");
  479. print("</div>");
  480. print("<br/>");
  481. print("<br/>");
  482.  
  483. print("<div>");
  484. print("Twitter address: ");
  485. print("<input type='text' id='actorTwitterAdress' name='actorTwitterAdress' value='$value_TwitterAdress'>");
  486. print("</div>");
  487. print("<br/>");
  488. print("<br/>");
  489.  
  490. print("<div>");
  491. print("Gender: ");
  492. print("<select name ='actorGender' id='actorGender' value='$value_Gender'>");
  493. print("<option value='male'>Male</option>");
  494. print("<option value='female'>Female</option>");
  495. print("<option value='other'>Other</option>");
  496. print("</select>");
  497. print("</div>");
  498. print("<br/>");
  499.  
  500. print("<div>");
  501. print("Type: ");
  502. print("<select name ='actorType' id='actorType' value='$value_Type' selected>");
  503. print("<option value='actor'>Actor</option>");
  504. print("<option value='Cast Member'>Cast Member</option>");
  505. print("<option value='Voice Actor'>Voice Actor</option>");
  506. print("<option value='Producer'>Producer</option>");
  507. print("<option value='Director'>Director</option>");
  508. print("</select>");
  509. print("</div>");
  510. }
  511. add_action('add_meta_boxes', 'gmm_add_custom_box');
  512.  
  513.  
  514.  
  515. function gmm_save_postdata($post_id){
  516. //bepaal het (custom type)
  517. $naam_post_type = get_post_type($post_id);
  518. if ($naam_post_type){
  519. //het gaat om een Custom post type want er bestaat een post_type (het is niet leeg)
  520. if ($naam_post_type == "episodes"){
  521. //het custom post type is episodes
  522. // $actors = get_all_of_post_type('Actors');
  523. // foreach($actors as $actor){
  524. // if (array_key_exists($actor, $_POST)) {
  525. // update_post_meta(
  526. // $post_id,
  527. // '_actor',
  528. // $_POST['actorID']
  529. // );
  530. // }
  531. // }
  532.  
  533.  
  534. if (array_key_exists('episodeRelease', $_POST)) {
  535. update_post_meta(
  536. $post_id,
  537. '_episodeRelease',
  538. $_POST['episodeRelease']
  539. );
  540. }
  541. if (array_key_exists('episodeNumber', $_POST)) {
  542. update_post_meta(
  543. $post_id,
  544. '_episodeNumber',
  545. $_POST['episodeNumber']
  546. );
  547. }
  548. if (array_key_exists('episodeTime', $_POST)) {
  549. update_post_meta(
  550. $post_id,
  551. '_episodeTime',
  552. $_POST['episodeTime']
  553. );
  554. }
  555. if (array_key_exists('connectedSerieID', $_POST)) {
  556. update_post_meta(
  557. $post_id,
  558. '_connectedSerieID',
  559. $_POST['connectedSerieID']
  560. );
  561. }
  562. if (array_key_exists('connectedSerieTitle', $_POST)) {
  563. update_post_meta(
  564. $post_id,
  565. '_connectedSerieTitle',
  566. $_POST['connectedSerieTitle']
  567. );
  568. }
  569. if (array_key_exists('connectedSeason', $_POST)) {
  570. update_post_meta(
  571. $post_id,
  572. '_connectedSeason',
  573. $_POST['connectedSeason']
  574. );
  575. }
  576. }
  577. if ($naam_post_type == "series"){
  578. //het custom post type is series
  579. if (array_key_exists('seasons', $_POST)) {
  580. update_post_meta(
  581. $post_id,
  582. '_seasons',
  583. $_POST['seasons']
  584. );
  585. }
  586. if (array_key_exists('start', $_POST)) {
  587. update_post_meta(
  588. $post_id,
  589. '_start',
  590. $_POST['start']
  591. );
  592. }
  593. if (array_key_exists('end', $_POST)) {
  594. update_post_meta(
  595. $post_id,
  596. '_end',
  597. $_POST['end']
  598. );
  599. }
  600. if (array_key_exists('language', $_POST)) {
  601. update_post_meta(
  602. $post_id,
  603. '_language',
  604. $_POST['language']
  605. );
  606. }
  607. if (array_key_exists('subtitles', $_POST)) {
  608. update_post_meta(
  609. $post_id,
  610. '_subtitles',
  611. $_POST['subtitles']
  612. );
  613. }
  614. if (array_key_exists('imageFormat', $_POST)) {
  615. update_post_meta(
  616. $post_id,
  617. '_imageFormat',
  618. $_POST['imageFormat']
  619. );
  620. }
  621. if (array_key_exists('productionHouse', $_POST)) {
  622. update_post_meta(
  623. $post_id,
  624. '_productionHouse',
  625. $_POST['productionHouse']
  626. );
  627. }
  628. if (array_key_exists('vieuwerGuide', $_POST)) {
  629. update_post_meta(
  630. $post_id,
  631. '_vieuwerGuide',
  632. $_POST['vieuwerGuide']
  633. );
  634. }
  635. if (array_key_exists('format', $_POST)) {
  636. update_post_meta(
  637. $post_id,
  638. '_format',
  639. $_POST['format']
  640. );
  641. }
  642. if (array_key_exists('genre', $_POST)) {
  643. update_post_meta(
  644. $post_id,
  645. '_genre',
  646. $_POST['genre']
  647. );
  648. }
  649.  
  650. }
  651. if ($naam_post_type == "actors"){
  652. //het custom post type is actors
  653. if (array_key_exists('actorFirstName', $_POST)) {
  654. update_post_meta(
  655. $post_id,
  656. '_actorFirstName',
  657. $_POST['actorFirstName']
  658. );
  659. }
  660. if (array_key_exists('actorLastName', $_POST)) {
  661. update_post_meta(
  662. $post_id,
  663. '_actorLastName',
  664. $_POST['actorLastName']
  665. );
  666. }
  667. if (array_key_exists('actorNationality', $_POST)) {
  668. update_post_meta(
  669. $post_id,
  670. '_actorNationality',
  671. $_POST['actorNationality']
  672. );
  673. }
  674. if (array_key_exists('actorBirthDate', $_POST)) {
  675. update_post_meta(
  676. $post_id,
  677. '_actorBirthDate',
  678. $_POST['actorBirthDate']
  679. );
  680. }
  681. if (array_key_exists('actorTwitterAdress', $_POST)) {
  682. update_post_meta(
  683. $post_id,
  684. '_actorTwitterAdress',
  685. $_POST['actorTwitterAdress']
  686. );
  687. }
  688. if (array_key_exists('actorGender', $_POST)) {
  689. update_post_meta(
  690. $post_id,
  691. '_actorGender',
  692. $_POST['actorGender']
  693. );
  694. }
  695. if (array_key_exists('actorType', $_POST)) {
  696. update_post_meta(
  697. $post_id,
  698. '_actorType',
  699. $_POST['actorType']
  700. );
  701. }
  702. }
  703. }
  704. }
  705. add_action('save_post', 'gmm_save_postdata');
  706.  
  707.  
  708.  
  709. function get_all_of_post_type ( $type_name = ''){
  710. $items = array();
  711. if (!empty( $type_name )){
  712. $args = array(
  713. 'post_type' => "{$type_name}",
  714. 'posts_per_page' => -1,
  715. 'order' => 'ASC',
  716. 'orderby' => 'title'
  717. );
  718. $results = get_posts( $args );
  719. }
  720. return $results;
  721. }
  722.  
  723.  
  724. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement