Benutzerdefinierte Felder verwenden - How to use custom fields

Dieses Tutorial beschäftigt sich mit der grundsätzlichen Verwendung der Benutzerdefinierten Felder in BranfordMagazine. Es aber auch entsprechend für WyntonMagazine anwendbar, da das Prinzip das Gleiche ist.
The english version of this tutorial can be found further down the page.

Alle Bildschirmansichten sind aus einem WordPress 2.5 Administrationsmenue entnommen. In älteren Versionen kann das natürlich etwas anders aussehen. Das Prinzip bleibt aber gleich.

Wie man Benutzerderfinierte Felder anlegt

Zunächst legt man einen neuen Beitrag an und weißt ihm die gewünschte Kategorie zu. Ich erläutere das Beispiel an einem “Featured Article” also den Artikeln in der linken Spalte der Homepage. Unterhalb des Bereich, wo Du Deinen Text eingegeben hast, findest Du den Bereich “Benutzerdefinierte Felder”. Klick auf das kleine Dreieck, um den Bereich zu öffnen, falls er geschlossen ist.

Zum Vergrößern klicken - Click to enlarge

Falls Du bereits Benutzerdefinierte Felder angelegt hast, findest Du diese links in dem Dropdown Menü. Falls nicht musst Du, um das Bild auf der Homepage für einen “Featured Article” anzuzeigen, bei “Schlüssel” die Bezeichnung des jeweiligen Feldes eingeben. In dem Fall ist es “featuredarticleimage”. Einmal angelegt, erscheint der Schlüssel bei jedem neuen Post im Dropdown Menü und kann darüber einfach ausgewählt werden.

Wie man dem Feld seinen Wert zuweist

Der Wert eines Benutzerdefinierten Feldes ist in dem Fall der Teil des Bilderpfades in Deinem Upload Verzeichnis Deiner WordPress Instalation, der nach dem Uploadverzeichnis steht. Das ist normalerweise das Verzeichnis /uploads. Dieses Verzeichnis wird vom Theme automatisch erkannt.

Zum Vergrößern klicken - Click to enlarge

Um nun den Pfad als Wert einzugeben, musst Du ein passendes Bild hochladen. Dazu verwendest Du einfach die Standard Funktion von WordPress, die in der Version 2.5 komplett neu ist.

Step 3

Der Teil, den Du benötigst, ist hier im Bild markiert. Beachte, dass Du nur diesen Teil als Wert im benutzerdefinierten Feld eingibst.

customfieldstut041

Klicke auf “Hinzufügen”.

customfieldstut05

Du hast jetzt also einen Schlüssel mit der Bezeichnung “leadarticleimage” und den Wert “2008/04/featuredimage_011.jpg”

customfieldstut06

Jetzt musst Du Deinen Beitrag nur noch Speichern und das war´s.

Beim Leitartikel und den Artikeln der mittleren Homepagespalte gehst Du im Grunde genauso vor, nur dass Du hier eben die entsprechenden “Schlüssel” verwenden musst.


English version

All screenshots are taken from a WordPress 2.5 administration and BranfordMagazine theme. In general it´s the same for WyntonMagazine. In older versions of WordPress this might a bit different. But it´s basically the same.

How to setup custom fields

Start with a new post and add the required category. In this example it´s the “featured article” catagory which is the three highlighted articles in the left column of the homepage.

Below the area where you put your text/copy you´ll fin the “custom fields” area. Click on the small triangle to open the area in case it´s closed.

Zum Vergrößern klicken - Click to enlarge

If you already have added custom fields you can use the dropdown menu. If not you have to set up the “keys”. For the image of a fetaured article the relevant “key” is in this case called “featuredarticleimage”. Once you´ve set them up they appear in the dropdown menu for every future post.

How to add a value to a custom field

The value of a custom field in this case is the path to the relevant image located in your upload directory of your WordPress installation. Normally the upload directoy is located under wp-content/uploads. This directory will be detected automatically by the theme.

Step 2

You have to upload an image that fits to the article. Use the standard WordPress upload functionality which is completely new in WordPress 2.5.

Step 3

The part that you need is highlighted in the screenshot. Make sure you take only this part as the custom fields value.

customfieldstut041

Click on “Add custom field”.

customfieldstut05

Now you have added a key called “leadarticleimage” with the value of “2008/04/featuredimage_011.jpg”

customfieldstut06

Now just save the post and you´re done.

With the leadarticle and the middle homepage column you do more or less exactly the same. Of course you need to use the relevant key for those areas.




About this entry