Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // overschrijf parent style CSS
- add_action( 'wp_enqueue_scripts', 'gmm_enqueue_styles' );
- function gmm_enqueue_styles() {
- $parent_style = 'parent-style'; // This is 'twentyfifteen-style' for the Twenty Fifteen theme.
- wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
- wp_enqueue_style( 'child-style',
- get_stylesheet_directory_uri() . '/screen.css',
- array( $parent_style ),
- wp_get_theme()->get('Version')
- );
- }
- //aanmaken custom post type actors
- if ( ! function_exists('gmm_actors') ) {
- // Register Custom Post Type
- function gmm_actors() {
- $labels = array(
- 'name' => 'Actors',
- 'singular_name' => 'Actor',
- 'menu_name' => 'Actors',
- 'name_admin_bar' => 'Actors',
- 'archives' => 'Actors',
- 'attributes' => 'Actors Attributes',
- 'parent_item_colon' => 'Parent Item:',
- 'all_items' => 'All Items',
- 'add_new_item' => 'Add new actor',
- 'add_new' => 'New Actor',
- 'new_item' => 'New Actor',
- 'edit_item' => 'Edit Actor',
- 'update_item' => 'Update Actor',
- 'view_item' => 'View Actor',
- 'view_items' => 'View Actors',
- 'search_items' => 'Search Actors',
- 'not_found' => 'Not found',
- 'not_found_in_trash' => 'Not found in Trash',
- 'featured_image' => 'Featured Image',
- 'set_featured_image' => 'Set featured image',
- 'remove_featured_image' => 'Remove featured image',
- 'use_featured_image' => 'Use as featured image',
- 'insert_into_item' => 'Insert into item',
- 'uploaded_to_this_item' => 'Uploaded to this item',
- 'items_list' => 'Actors list',
- 'items_list_navigation' => 'Actors list navigation',
- 'filter_items_list' => 'Filter Actors list',
- );
- $args = array(
- 'label' => 'Actor',
- 'description' => 'Actors & Cast members',
- 'labels' => $labels,
- 'supports' => array( 'title', 'editor', 'thumbnail', 'revisions' ),
- 'hierarchical' => false,
- 'public' => true,
- 'show_ui' => true,
- 'show_in_menu' => true,
- 'menu_position' => 5,
- 'menu_icon' => 'dashicons-universal-access-alt',
- 'show_in_admin_bar' => true,
- 'show_in_nav_menus' => true,
- 'can_export' => true,
- 'has_archive' => true,
- 'exclude_from_search' => false,
- 'publicly_queryable' => true,
- 'capability_type' => 'page',
- );
- register_post_type( 'actors', $args );
- }
- add_action( 'init', 'gmm_actors', 0 );
- }
- //aanmaken custom post type series
- if ( ! function_exists('gmm_series') ) {
- // Register Custom Post Type
- function gmm_series() {
- $labels = array(
- 'name' => 'Series',
- 'singular_name' => 'Serie',
- 'menu_name' => 'Series',
- 'name_admin_bar' => 'Series',
- 'archives' => 'Series',
- 'attributes' => 'Series Attributes',
- 'parent_item_colon' => 'Parent Item:',
- 'all_items' => 'All Items',
- 'add_new_item' => 'Add new serie',
- 'add_new' => 'New Serie',
- 'new_item' => 'New Serie',
- 'edit_item' => 'Edit Serie',
- 'update_item' => 'Update Serie',
- 'view_item' => 'View Serie',
- 'view_items' => 'View Series',
- 'search_items' => 'Search Series',
- 'not_found' => 'Not found',
- 'not_found_in_trash' => 'Not found in Trash',
- 'featured_image' => 'Featured Image',
- 'set_featured_image' => 'Set featured image',
- 'remove_featured_image' => 'Remove featured image',
- 'use_featured_image' => 'Use as featured image',
- 'insert_into_item' => 'Insert into item',
- 'uploaded_to_this_item' => 'Uploaded to this item',
- 'items_list' => 'Series list',
- 'items_list_navigation' => 'Series list navigation',
- 'filter_items_list' => 'Filter Series list',
- );
- $args = array(
- 'label' => 'Serie',
- 'description' => 'Series',
- 'labels' => $labels,
- 'supports' => array( 'title', 'editor', 'thumbnail', 'revisions' ),
- 'hierarchical' => false,
- 'public' => true,
- 'show_ui' => true,
- 'show_in_menu' => true,
- 'menu_position' => 5,
- 'menu_icon' => 'dashicons-video-alt3',
- 'show_in_admin_bar' => true,
- 'show_in_nav_menus' => true,
- 'can_export' => true,
- 'has_archive' => true,
- 'exclude_from_search' => false,
- 'publicly_queryable' => true,
- 'capability_type' => 'page',
- 'show_in_rest' => true,
- );
- register_post_type( 'series', $args );
- }
- add_action( 'init', 'gmm_series', 0 );
- }
- //aanmaken custom post type Episodes
- if ( ! function_exists('Episodes') ) {
- // Register Custom Post Type
- function Episodes() {
- $labels = array(
- 'name' => _x( 'Episodes', 'Post Type General Name', 'text_domain' ),
- 'singular_name' => _x( 'Episode', 'Post Type Singular Name', 'text_domain' ),
- 'menu_name' => __( 'Episodes', 'text_domain' ),
- 'name_admin_bar' => __( 'Episodes', 'text_domain' ),
- 'archives' => __( 'Episodes archief', 'text_domain' ),
- 'attributes' => __( 'Episode Attributes', 'text_domain' ),
- 'parent_item_colon' => __( 'Parent Item:', 'text_domain' ),
- 'all_items' => __( 'All Items', 'text_domain' ),
- 'add_new_item' => __( 'Add New episode', 'text_domain' ),
- 'add_new' => __( 'New Episode', 'text_domain' ),
- 'new_item' => __( 'New Episode', 'text_domain' ),
- 'edit_item' => __( 'Edit Episode', 'text_domain' ),
- 'update_item' => __( 'Update Episode', 'text_domain' ),
- 'view_item' => __( 'View Episode', 'text_domain' ),
- 'view_items' => __( 'View Episodes', 'text_domain' ),
- 'search_items' => __( 'Search Episode', 'text_domain' ),
- 'not_found' => __( 'Not found', 'text_domain' ),
- 'not_found_in_trash' => __( 'Not found in Trash', 'text_domain' ),
- 'featured_image' => __( 'Featured Image', 'text_domain' ),
- 'set_featured_image' => __( 'Set featured image', 'text_domain' ),
- 'remove_featured_image' => __( 'Remove featured image', 'text_domain' ),
- 'use_featured_image' => __( 'Use as featured image', 'text_domain' ),
- 'insert_into_item' => __( 'Insert into item', 'text_domain' ),
- 'uploaded_to_this_item' => __( 'Uploaded to this item', 'text_domain' ),
- 'items_list' => __( 'Episodes list', 'text_domain' ),
- 'items_list_navigation' => __( 'Episodes list navigation', 'text_domain' ),
- 'filter_items_list' => __( 'Filter Episodes list', 'text_domain' ),
- );
- $args = array(
- 'label' => __( 'Episode', 'text_domain' ),
- 'description' => __( 'Episodes (series)', 'text_domain' ),
- 'labels' => $labels,
- 'supports' => array( 'title', 'editor', 'thumbnail', 'revisions'),
- 'taxonomies' => array( 'category', 'post_tag' ),
- 'hierarchical' => false,
- 'public' => true,
- 'show_ui' => true,
- 'show_in_menu' => true,
- 'menu_position' => 5,
- 'menu_icon' => 'dashicons-video-alt2',
- 'show_in_admin_bar' => true,
- 'show_in_nav_menus' => true,
- 'can_export' => true,
- 'has_archive' => true,
- 'exclude_from_search' => false,
- 'publicly_queryable' => true,
- 'capability_type' => 'page',
- 'show_in_rest' => true,
- );
- register_post_type( 'Episodes', $args );
- }
- add_action( 'init', 'Episodes', 0 );
- }
- //aanmaken alle custom velden
- function gmm_add_custom_box(){
- add_meta_box(
- 'gmm_actor_box_id', // Unique ID
- 'Actor Info', // Box title
- 'gmm_custom_box_Actors_html', // Content callback, must be of type callable
- 'Actors' // Post type
- );
- add_meta_box(
- 'gmm_serie_box_id', // Unique ID
- 'Serie Info', // Box title
- 'gmm_custom_box_Series_html', // Content callback, must be of type callable
- 'Series' // Post type
- );
- add_meta_box(
- 'gmm_episode_box_id', // Unique ID
- 'Episode Info', // Box title
- 'gmm_custom_box_Episode_html', // Content callback, must be of type callable
- 'Episodes' // Post type
- );
- add_meta_box(
- 'gmm_episodeSerie_box_id', // Unique ID
- 'Serie select', // Box title
- 'gmm_custom_box_EpisodeSerie_html', // Content callback, must be of type callable
- 'Episodes' // Post type
- );
- add_meta_box(
- 'gmm_EpisodeActor_box_id', // Unique ID
- 'Actor select', // Box title
- 'gmm_custom_box_EpisodeActor_html', // Content callback, must be of type callable
- 'Episodes' // Post type
- );
- }
- //Genereren custom velden Series
- function gmm_custom_box_Series_html($post){
- $value_Start = get_post_meta($post->ID, '_start', true);
- if($value_Start == NULL){$value_Start = "Unknown year";}
- $value_End = get_post_meta($post->ID, '_end', true);
- if($value_End == NULL){$value_End = "Present";}
- $value_Seasons = get_post_meta($post->ID, '_seasons', true);
- if($value_Seasons == NULL){$value_Seasons = "Unknown";}
- $value_Language = get_post_meta($post->ID, '_language', true);
- if($value_Language == NULL){$value_Language = "Unknown";}
- $value_Subtitles = get_post_meta($post->ID, '_subtitles', true);
- if($value_Subtitles == NULL){$value_Subtitles = "Unknown";}
- $value_ImageFormat = get_post_meta($post->ID, '_imageFormat', true);
- if($value_ImageFormat == NULL){$value_ImageFormat = "Unknown";}
- $value_ProductionHouse = get_post_meta($post->ID, '_productionHouse', true);
- if($value_ProductionHouse == NULL){$value_ProductionHouse = "Unknown";}
- $value_VieuwerGuide = get_post_meta($post->ID, '_vieuwerGuide', true);
- if($value_VieuwerGuide == NULL){$value_VieuwerGuide = "No vieuwer guide";}
- $value_Format = get_post_meta($post->ID, '_format', true);
- if($value_Format == NULL){$value_Format = "Unknown";}
- $value_Genre = get_post_meta($post->ID, '_genre', true);
- if($value_Genre == NULL){$value_Genre = "Genre Unknown";}
- print("<div>");
- print("Serie year start: ");
- print("<input type='number' id='start' name='start' value='". $value_Start . "'");
- print("</div>");
- print("<br/>");
- print("<br/>");
- print("<div>");
- print("Serie year End: ");
- print("<input type='number' id='end' name='end' value='". $value_End . "'");
- print("</div>");
- print("<br/>");
- print("<br/>");
- print("<div>");
- print("Season amount: ");
- print("<input type='number' id='seasons' name='seasons' value='". $value_Seasons . "'");
- print("</div>");
- print("<br/>");
- print("<br/>");
- print("<div>");
- print("Spoken language: ");
- print("<input type='text' id='language' name='language' value='". $value_Language . "'");
- print("</div>");
- print("<br/>");
- print("<br/>");
- print("<div>");
- print("Subtitles: ");
- print("<input type='checkbox' name='subtitles' value='true' ". ($value_Subtitles == 'true' ? "checked": "") . " id='subtitles'/>");
- print("</div>");
- print("<br/>");
- print("<br/>");
- print("<div>");
- print("Image format: ");
- print("<input type='text' id='imageFormat' name='imageFormat' value='". $value_ImageFormat . "'");
- print("</div>");
- print("<br/>");
- print("<br/>");
- print("<div>");
- print("Production house: ");
- print("<input type='text' id='productionHouse' name='productionHouse' value='". $value_ProductionHouse . "'");
- print("</div>");
- print("<br/>");
- print("<br/>");
- print("<div>");
- print("Vieuwer guide (age): ");
- print("<input type='text' name = vieuwerGuide id='vieuwerGuide' value='" . $value_VieuwerGuide . "'/>");
- print("</div>");
- print("<br/>");
- print("<div>");
- print("Select Format: ");
- print("<select name ='format' id='format'>");
- print("<option value='Clip' ".($value_Format == 'Clip' ? 'selected':"" ).">Clip</option>");
- print("<option value='Docufiction' ".($value_Format == 'Docufiction' ? 'selected':"" ).">Docufiction</option>");
- print("<option value='Documentary' ".($value_Format == 'Documentary' ? 'selected':"" ).">Documentary</option>");
- print("<option value='Single episode' ".($value_Format == 'Single episode' ? 'selected':"" ).">Single episode</option>");
- print("<option value='Made-for-TV film' ".($value_Format == 'Made-for-TV film' ? 'selected':"" ).">Made-for-TV film</option>");
- print("<option value='Franchise' ".($value_Format == 'Franchise' ? 'selected':"" ).">Franchise</option>");
- print("<option value='Mini-episode' ".($value_Format == 'Mini-episode' ? 'selected':"" ).">Mini-episode</option>");
- print("<option value='Mini-serie' ".($value_Format == 'Mini-serie' ? 'selected':"" ).">Mini-serie</option>");
- print("<option value='Micro-serie' ".($value_Format == 'Micro-serie' ? 'selected':"" ).">Micro-serie</option>");
- print("<option value='Mockumentary' ".($value_Format == 'Mockumentary' ? 'selected':"" ).">Mockumentary</option>");
- print("<option value='Pilot' ".($value_Format == 'Pilot' ? 'selected':"" ).">Pilot</option>");
- print("<option value='Prequel' ".($value_Format == 'Prequel' ? 'selected':"" ).">Prequel</option>");
- print("<option value='Reboot' ".($value_Format == 'Reboot' ? 'selected':"" ).">Reboot</option>");
- print("<option value='Remake' ".($value_Format == 'Remake' ? 'selected':"" ).">Remake</option>");
- print("<option value='Segment' ".($value_Format == 'Segment' ? 'selected':"" ).">Segment</option>");
- print("<option value='Sequel' ".($value_Format == 'Sequel' ? 'selected':"" ).">Sequel</option>");
- print("<option value='Serial' ".($value_Format == 'Serial' ? 'selected':"" ).">Serial</option>");
- print("<option value='Show' ".($value_Format == 'Show' ? 'selected':"" ).">Show</option>");
- print("<option value='Special' ".($value_Format == 'Special' ? 'selected':"" ).">Special</option>");
- print("<option value='Spin-off' ".($value_Format == 'Spin-off' ? 'selected':"" ).">Spin-off</option>");
- print("<option value='unaired episode' ".($value_Format == 'unaired episode' ? 'selected':"" ).">unaired episode/pilot</option>");
- print("</select>");
- print("</div>");
- print("<br/>");
- print("<div>");
- print("Select Genre: ");
- print("<select name ='genre' id='genre'>");
- print("<option value='Absurdist' ".($value_Genre == "Absurdist" ? 'selected':"" ).">Absurdist/surreal/whimsical</option>");
- print("<option value='Action' ".($value_Genre == "Action" ? 'selected':"" ).">Action</option>");
- print("<option value='Adventure' ".($value_Genre == "Adventure" ? 'selected':"" ).">Adventure</option>");
- print("<option value='Comedy' ".($value_Genre == "Comedy" ? 'selected':"" ).">Comedy</option>");
- print("<option value='Crime' ".($value_Genre == "Crime" ? 'selected':"" ).">Crime</option>");
- print("<option value='Drama' ".($value_Genre == "Drama" ? 'selected':"" ).">Drama</option>");
- print("<option value='Fantasy' ".($value_Genre == "Fantasy" ? 'selected':"" ).">Fantasy</option>");
- print("<option value='Historical' ".($value_Genre == "Historical" ? 'selected':"" ).">Historical</option>");
- print("<option value='Historical Fiction' ".($value_Genre == "Historical Fiction" ? 'selected':"" ).">Historical Fiction</option>");
- print("<option value='Horror' ".($value_Genre == "Horror" ? 'selected':"" ).">Horror</option>");
- print("<option value='Magical realism' ".($value_Genre == "Magical realism" ? 'selected':"" ).">Magical realism</option>");
- print("<option value='Mystery' ".($value_Genre == "Mystery" ? 'selected':"" ).">Mystery</option>");
- print("<option value='Paranoid Fiction' ".($value_Genre == "Paranoid Fiction" ? 'selected':"" ).">Paranoid Fiction</option>");
- print("<option value='Philosophical' ".($value_Genre == "Philosophical" ? 'selected':"" ).">Philosophical</option>");
- print("<option value='Political' ".($value_Genre == "Political" ? 'selected':"" ).">Political</option>");
- print("<option value='Romance' ".($value_Genre == "Romance" ? 'selected':"" ).">Romance</option>");
- print("<option value='Saga' ".($value_Genre == "Saga" ? 'selected':"" ).">Saga</option>");
- print("<option value='Satire' ".($value_Genre == "Satire" ? 'selected':"" ).">Satire</option>");
- print("<option value='Science fiction' ".($value_Genre == "Science fiction" ? 'selected':"" ).">Science fiction</option>");
- print("<option value='Social' ".($value_Genre == "Social" ? 'selected':"" ).">Social</option>");
- print("<option value='Speculative' ".($value_Genre == "Speculative" ? 'selected':"" ).">Speculative</option>");
- print("<option value='Thriller' ".($value_Genre == "Thriller" ? 'selected':"" ).">Thriller</option>");
- print("<option value='Urban' ".($value_Genre == "Urban" ? 'selected':"" ).">Urban</option>");
- print("<option value='Western' ".($value_Genre == "Western" ? 'selected':"" ).">Western</option>");
- print("</select>");
- print("</div>");
- print("<br/>");
- }
- function gmm_custom_box_EpisodeActor_html($post){
- print("<div>");
- $actors = get_all_of_post_type('Actors');
- foreach($actors as $actor){
- print("<div>");
- // print("<label>" . $actor . "</label>");
- print_r($actor->post_title . ": ");
- print("<input type='checkbox' name='actors' value='" . $actor->ID . "' ". ($value_Actor == 'true' ? "checked": "") . " id='actors'/>");
- print("</div>");
- }
- print("</div>");
- }
- //Genereren custom velden Episodes (post meta)
- function gmm_custom_box_Episode_html($post){
- $value_ReleaseDate = get_post_meta($post->ID, '_episodeRelease', true);
- $value_EpisodeNumber = get_post_meta($post->ID, '_episodeNumber', true);
- $value_EpisodeTime = get_post_meta($post->ID, '_episodeTime', true);
- print("<div>");
- print("Release Date: ");
- print("<input type='date' id='episodeRelease' name='episodeRelease' value='". $value_ReleaseDate . "'");
- print("</div>");
- print("<br/>");
- print("<br/>");
- print("<div>");
- print("Episode number: ");
- print("<input type='number' id='episodeNumber' name='episodeNumber' value='". $value_EpisodeNumber . "'");
- print("</div>");
- print("<br/>");
- print("<br/>");
- print("<div>");
- print("Episode time (minutes): ");
- print("<input type='number' id='episodeTime' name='episodeTime' value='". $value_EpisodeTime . "'");
- print("</div>");
- print("<br/>");
- print("<br/>");
- }
- //Genereren custom velden episodes (linked serie)
- function gmm_custom_box_EpisodeSerie_html($post){
- $connectedSerieID = get_post_meta($post->ID, '_connectedSerieID', true);
- $connectedSerieTitle = get_post_meta($post->ID, '_connectedSerieTitle', true);
- $value_ConnectedSeason = get_post_meta($post->ID, '_connectedSeason', true);
- $series = get_all_of_post_type('Series');
- print("<div>");
- print("Serie: ");
- print("<select name='connectedSerieID'>");
- foreach($series as $serie){
- print("<option name='connectedSerieID' value='" . $serie->ID . "' " . ($serie->ID == $connectedSerieID ? "selected":"") . ">");
- print($serie->post_title . "</option>");
- }
- print("</select>");
- print("</div>");
- print("<br/>");
- print("<div>");
- print("Season select: ");
- print("<input type='text' list='seasons' name='connectedSeason' id='connectedSeason' value='" . $value_ConnectedSeason . "'/>");
- print("<datalist id='seasons'>");
- print("<option></option>");
- print("</datalist>");
- print("</div>");
- print("<br/>");
- }
- //aanmaken custom velden bij Actors
- function gmm_custom_box_Actors_html($post){
- $value_FirstName = get_post_meta($post->ID, '_actorFirstName', true);
- $value_LastName = get_post_meta($post->ID, '_actorLastName', true);
- $value_Nationality = get_post_meta($post->ID, '_actorNationality', true);
- $value_BirthDate = get_post_meta($post->ID, '_actorBirthDate', true);
- $value_TwitterAdress = get_post_meta($post->ID, '_actorTwitterAdress', true);
- $value_Gender = get_post_meta($post->ID, '_actorGender', true);
- $value_Type = get_post_meta($post->ID, '_actorType', true);
- print("<div>");
- print("First Name: ");
- print("<input type='text' id='actorFirstName' name='actorFirstName' value='$value_FirstName'>");
- print("</div>");
- print("<br/>");
- print("<br/>");
- print("<div>");
- print("Last Name: ");
- print("<input type='text' id='actorLastName' name='actorLastName' value='$value_LastName'>");
- print("</div>");
- print("<br/>");
- print("<br/>");
- print("<div>");
- print("Nationality: ");
- print("<input type='text' id='actorNationality' name='actorNationality' value='$value_Nationality'>");
- print("</div>");
- print("<br/>");
- print("<br/>");
- print("<div>");
- print("Birth date: ");
- print("<input type='date' id='actorBirthDate' name='actorBirthDate' value='$value_BirthDate'>");
- print("</div>");
- print("<br/>");
- print("<br/>");
- print("<div>");
- print("Twitter address: ");
- print("<input type='text' id='actorTwitterAdress' name='actorTwitterAdress' value='$value_TwitterAdress'>");
- print("</div>");
- print("<br/>");
- print("<br/>");
- print("<div>");
- print("Gender: ");
- print("<select name ='actorGender' id='actorGender' value='$value_Gender'>");
- print("<option value='male'>Male</option>");
- print("<option value='female'>Female</option>");
- print("<option value='other'>Other</option>");
- print("</select>");
- print("</div>");
- print("<br/>");
- print("<div>");
- print("Type: ");
- print("<select name ='actorType' id='actorType' value='$value_Type' selected>");
- print("<option value='actor'>Actor</option>");
- print("<option value='Cast Member'>Cast Member</option>");
- print("<option value='Voice Actor'>Voice Actor</option>");
- print("<option value='Producer'>Producer</option>");
- print("<option value='Director'>Director</option>");
- print("</select>");
- print("</div>");
- }
- add_action('add_meta_boxes', 'gmm_add_custom_box');
- function gmm_save_postdata($post_id){
- //bepaal het (custom type)
- $naam_post_type = get_post_type($post_id);
- if ($naam_post_type){
- //het gaat om een Custom post type want er bestaat een post_type (het is niet leeg)
- if ($naam_post_type == "episodes"){
- //het custom post type is episodes
- // $actors = get_all_of_post_type('Actors');
- // foreach($actors as $actor){
- // if (array_key_exists($actor, $_POST)) {
- // update_post_meta(
- // $post_id,
- // '_actor',
- // $_POST['actorID']
- // );
- // }
- // }
- if (array_key_exists('episodeRelease', $_POST)) {
- update_post_meta(
- $post_id,
- '_episodeRelease',
- $_POST['episodeRelease']
- );
- }
- if (array_key_exists('episodeNumber', $_POST)) {
- update_post_meta(
- $post_id,
- '_episodeNumber',
- $_POST['episodeNumber']
- );
- }
- if (array_key_exists('episodeTime', $_POST)) {
- update_post_meta(
- $post_id,
- '_episodeTime',
- $_POST['episodeTime']
- );
- }
- if (array_key_exists('connectedSerieID', $_POST)) {
- update_post_meta(
- $post_id,
- '_connectedSerieID',
- $_POST['connectedSerieID']
- );
- }
- if (array_key_exists('connectedSerieTitle', $_POST)) {
- update_post_meta(
- $post_id,
- '_connectedSerieTitle',
- $_POST['connectedSerieTitle']
- );
- }
- if (array_key_exists('connectedSeason', $_POST)) {
- update_post_meta(
- $post_id,
- '_connectedSeason',
- $_POST['connectedSeason']
- );
- }
- }
- if ($naam_post_type == "series"){
- //het custom post type is series
- if (array_key_exists('seasons', $_POST)) {
- update_post_meta(
- $post_id,
- '_seasons',
- $_POST['seasons']
- );
- }
- if (array_key_exists('start', $_POST)) {
- update_post_meta(
- $post_id,
- '_start',
- $_POST['start']
- );
- }
- if (array_key_exists('end', $_POST)) {
- update_post_meta(
- $post_id,
- '_end',
- $_POST['end']
- );
- }
- if (array_key_exists('language', $_POST)) {
- update_post_meta(
- $post_id,
- '_language',
- $_POST['language']
- );
- }
- if (array_key_exists('subtitles', $_POST)) {
- update_post_meta(
- $post_id,
- '_subtitles',
- $_POST['subtitles']
- );
- }
- if (array_key_exists('imageFormat', $_POST)) {
- update_post_meta(
- $post_id,
- '_imageFormat',
- $_POST['imageFormat']
- );
- }
- if (array_key_exists('productionHouse', $_POST)) {
- update_post_meta(
- $post_id,
- '_productionHouse',
- $_POST['productionHouse']
- );
- }
- if (array_key_exists('vieuwerGuide', $_POST)) {
- update_post_meta(
- $post_id,
- '_vieuwerGuide',
- $_POST['vieuwerGuide']
- );
- }
- if (array_key_exists('format', $_POST)) {
- update_post_meta(
- $post_id,
- '_format',
- $_POST['format']
- );
- }
- if (array_key_exists('genre', $_POST)) {
- update_post_meta(
- $post_id,
- '_genre',
- $_POST['genre']
- );
- }
- }
- if ($naam_post_type == "actors"){
- //het custom post type is actors
- if (array_key_exists('actorFirstName', $_POST)) {
- update_post_meta(
- $post_id,
- '_actorFirstName',
- $_POST['actorFirstName']
- );
- }
- if (array_key_exists('actorLastName', $_POST)) {
- update_post_meta(
- $post_id,
- '_actorLastName',
- $_POST['actorLastName']
- );
- }
- if (array_key_exists('actorNationality', $_POST)) {
- update_post_meta(
- $post_id,
- '_actorNationality',
- $_POST['actorNationality']
- );
- }
- if (array_key_exists('actorBirthDate', $_POST)) {
- update_post_meta(
- $post_id,
- '_actorBirthDate',
- $_POST['actorBirthDate']
- );
- }
- if (array_key_exists('actorTwitterAdress', $_POST)) {
- update_post_meta(
- $post_id,
- '_actorTwitterAdress',
- $_POST['actorTwitterAdress']
- );
- }
- if (array_key_exists('actorGender', $_POST)) {
- update_post_meta(
- $post_id,
- '_actorGender',
- $_POST['actorGender']
- );
- }
- if (array_key_exists('actorType', $_POST)) {
- update_post_meta(
- $post_id,
- '_actorType',
- $_POST['actorType']
- );
- }
- }
- }
- }
- add_action('save_post', 'gmm_save_postdata');
- function get_all_of_post_type ( $type_name = ''){
- $items = array();
- if (!empty( $type_name )){
- $args = array(
- 'post_type' => "{$type_name}",
- 'posts_per_page' => -1,
- 'order' => 'ASC',
- 'orderby' => 'title'
- );
- $results = get_posts( $args );
- }
- return $results;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement