Hello zusammen,
ich versuche jetzt mal hier mein Glück denn ich komme leider allein nicht mehr weiter. Ich bin ein Neuling beim Thema Wordpress und versuche gerade Metaboxen nach dem Beispiel hier links in Wordpress zu bauen. Ich stelle die HTML Seite gerade auf Wordpress um. Ich benutze Atahualpa 3.7.3 mit dem 3.3 WP release.
Die Felder sollen dem Verfasser ermöglichen die relevanten Daten wie Publisher oder Preis einzugeben, das USK Bild sollte ausgewählt und dann aus der Mediathek geladen werden.
Wäre schön wenn Ihr beim anworten dann 1. oder 2. angeben könntet.
1. Zuerst habe ich das Plugin Advanced Custom Fields versucht, welches es ermöglicht Custom Felder zu erstellen.
Ich habe nun die Custom fields und ihre Namen. Das PI hat sogar eine Option den dazugehörigen php code auszugeben (siehe unten). Damit die Felder aber nun im Frontend auftauchen, muss der Code wohl ins Template kommen, genau da steckt mein Problem.
/**
* Activate Add-ons
* Here you can enter your activation codes to unlock Add-ons to use in your theme.
* Since all activation codes are multi-site licenses, you are allowed to include your key in premium themes.
* Use the commented out code to update the database with your activation code.
* You may place this code inside an IF statement that only runs on theme activation.
*/
// if(!get_option('acf_repeater_ac')) update_option('acf_repeater_ac', "xxxx-xxxx-xxxx-xxxx");
// if(!get_option('acf_options_ac')) update_option('acf_options_ac', "xxxx-xxxx-xxxx-xxxx");
// if(!get_option('acf_flexible_content_ac')) update_option('acf_flexible_content_ac', "xxxx-xxxx-xxxx-xxxx");
/**
* Register field groups
* The register_field_group function accepts 1 array which holds the relevant data to register a field group
* You may edit the array as you see fit. However, this may result in errors if the array is not compatible with ACF
* This code must run every time the functions.php file is read
*/
if(function_exists("register_field_group"))
{
register_field_group(array (
'id' => '4f80551e79455',
'title' => 'ReviewsMetaBox',
'fields' =>
array (
0 =>
array (
'key' => 'field_4f7f4b357fe0d',
'label' => 'Cover',
'name' => 'cover1',
'type' => 'image',
'instructions' => 'Hier das Coverbild einfügen',
'required' => '1',
'save_format' => 'url',
'preview_size' => 'full',
'order_no' => '0',
),
1 =>
array (
'key' => 'field_4f7f4b3580dbb',
'label' => 'Spielname',
'name' => 'name1',
'type' => 'text',
'instructions' => 'Der Name des Games',
'required' => '1',
'default_value' => '',
'formatting' => 'html',
'order_no' => '1',
),
2 =>
array (
'key' => 'field_4f7f4b3581960',
'label' => 'Preis',
'name' => 'preis1',
'type' => 'text',
'instructions' => 'Der ca. Ladenpreis',
'required' => '1',
'default_value' => '',
'formatting' => 'html',
'order_no' => '2',
),
3 =>
array (
'key' => 'field_4f7f4b3582515',
'label' => 'Entwickler',
'name' => 'entwickler1',
'type' => 'text',
'instructions' => 'Der Entwickler des Spiels',
'required' => '1',
'default_value' => '',
'formatting' => 'html',
'order_no' => '3',
),
4 =>
array (
'key' => 'field_4f7f4b35830e1',
'label' => 'Publisher',
'name' => 'publisher1',
'type' => 'text',
'instructions' => 'Der Publisher (Vertrieb) des Spiels',
'required' => '1',
'default_value' => '',
'formatting' => 'html',
'order_no' => '4',
),
5 =>
array (
'key' => 'field_4f7f4b3583c9e',
'label' => 'USK',
'name' => 'usk1',
'type' => 'select',
'instructions' => 'Die USK Einstufung',
'required' => '1',
'choices' =>
array (
0 => '0',
6 => '6',
12 => '12',
16 => '16',
18 => '18',
'' => '',
),
'default_value' => '',
'allow_null' => '0',
'multiple' => '0',
'order_no' => '5',
),
6 =>
array (
'key' => 'field_4f7f4b3584858',
'label' => 'USK Logo',
'name' => 'uskbild1',
'type' => 'image',
'instructions' => 'Das USK Bild',
'required' => '1',
'save_format' => 'id',
'preview_size' => 'full',
'order_no' => '6',
),
),
'location' =>
array (
'rules' =>
array (
0 =>
array (
'param' => 'post_category',
'operator' => '==',
'value' => '4',
'order_no' => '0',
),
),
'allorany' => 'all',
),
'options' =>
array (
'position' => 'side',
'layout' => 'default',
'show_on_page' =>
array (
0 => 'custom_fields',
),
),
'menu_order' => 0,
));
}
Alles anzeigen
2. Ausserdem habe ich Verve Meta Boxes versucht, die damit erstellten Felder werden auch prompt im Backend angezeigt wenn ich ein neues Posting machen will, erscheinen aber nicht im Frontend.
In der Anleitung steht:
Zitat
- ich habe es aber nicht hinbekommen die richtige Stelle im richtigen Template zu finden.
Ich bräuchte jetzt entweder Hilfe dazu wo ich den Code für 1. oder 2. einfügen soll oder alternativ ein Plugin das funktioniert ohne dass ich am Template herumschrauben muss - habe ich WP.org Verzeichnis nichts passendes gefunden :(