Overview page in backend does not show column values
-
I’m trying to make the overview page for my custom page type, but I can not get WP to display the custom field values, even though it’s possible to print the column headings.
I have defined the custom fields in the functions.php and in the individual pages they are also displayed correctly:add_action("admin_init","cpt_workshop_meta_boxen"); add_action('save_post','cpt_workshop_daten_speichern'); function cpt_workshop_meta_boxen(){ add_meta_box("art-meta", "Workshopart","cpt_workshop_feld_art", "workshopseite","normal","default"); add_meta_box("datum-meta", "Datum","cpt_workshop_feld_datum", "workshopseite","normal","default"); add_meta_box("ort-meta", "Ort","cpt_workshop_feld_ort", "workshopseite","normal","default"); add_meta_box("leitung-meta", "Leitung","cpt_workshop_feld_leitung", "workshopseite","normal","default"); } function cpt_workshop_feld_art(){ global $post; $custom = get_post_custom($post->ID); $art = $custom["art"][0]; echo '<input name="art" value="' . $art . '" />'; } function cpt_workshop_feld_datum(){ global $post; $custom = get_post_custom($post->ID); $datum = $custom["datum"][0]; echo '<input name="datum" value="' . $datum . '" />'; } function cpt_workshop_feld_ort(){ global $post; $custom = get_post_custom($post->ID); $ort = $custom["ort"][0]; echo '<input name="ort" value="' . $ort . '" />'; } function cpt_workshop_feld_leitung(){ global $post; $custom = get_post_custom($post->ID); $leitung = $custom["leitung"][0]; echo '<input name="leitung" value="' . $leitung . '" />'; } function cpt_workshop_daten_speichern (){ global $post; update_post_meta($post->ID, "art", $_POST["art"]); update_post_meta($post->ID, "datum", $_POST["datum"]); update_post_meta($post->ID, "ort", $_POST["ort"]); update_post_meta($post->ID, "leitung", $_POST["leitung"]); }
In the overview page, I just do not get the values displayed. The code in the functions.php:
add_filter("manage_edit-workshopseite_columns", "cpt_workshopseite_spalten"); add_action("manage_posts_custom_column", "cpt_workshopseite_neue_spalte"); function cpt_workshopseite_spalten($columns){ $columns = array( "cb" => "<input type=\"checkbox\" />", "title" => "Workshoptitel", "datum" => "Datum", "ort" => "Ort", "date" => "Hinzugefügt" ); return $columns; } function cpt_workshopseite_neue_spalte($column){ global $post; if ("datum" == $column) { $custom = get_post_custom(); echo $custom["datum"][0]; } elseif ("ort" == $column) { $custom = get_post_custom(); echo $custom["ort"][0]; } }
What am I doing wrong ?
??
Brgds
WorelsThe page I need help with: [log in to see the link]
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Overview page in backend does not show column values’ is closed to new replies.