Wordpress Custom Fields

Worpress Custom Fields

You must first edit the post or page on which you want to add the custom field and go to the Custom Fields meta box. Next, you must enter a name for your custom field and then enter its value. To save it, click the Add Custom Field button. Personalize WordPress with powerful, professional, and intuitive fields.

class="mw-headline" id="Function_Reference">Function reference

An additional encoding makes it possible to perform more sophisticated operations, such as using keywords to save an expiry date for a contribution. This value is the information that appears in the journal's listing of every single article to which the information is linked. You can use keys more than once per contribution.

If, for example, you have read two different volumes (perhaps a reference at work and a home fiction), you can make a "reading" code and use it twice on the same contribution, once for each volume. This is an example of how this information might look on your post: :

We' ll be adding two custom fields, one with the name "Reading Current" and the other with the name "Today's Mood". Use the following steps to learn how to use custom fields to include this information in a posting. Once you have finished writing your contribution, please browse down to the section entitled Custom Fields. 1, some display choices are disabled by defaults in the administration areas for editing posts and pages.

User-defined fields are suppressed by defaults if they have not yet been used. In order to generate a new custom box named "Read current", type the text "Read current" (without quotation marks) in the text input box entitled Name. You should now assign a value to the new key ("Read current"), which in our case is the name of the just finished Calvin and Hobbes text.

Enter "Calvin and Hobbes" in the Value box, again without the quotation marks. To store this custom information for this posting, click the Append Custom Box icon. In order to include your "Today's mood", please redo the operation and include "Today's mood" to the value text fields keys and a text describing your mood and click on the custom box to store this information with the posting.

In your next posting, you can include a new story and atmosphere in your metadata. The User Defined Fields section of the key now contains a pull-down menu with the previously specified User Defined Fields. Select "Read current" and then type the new one you are currently reviewing into the value.

When you click Join Custom Field, do the same again to join Today's Mood. Once you have to recreate a new "KEY", you can then set this value for each contribution, if you wish. It is also possible to allocate more than one value for a contribution to a single value assigned to a single entry.

It is useful for those who want to learn to read more than one volume at a time- Featuring a custom box added to the posting, it's your turn to present your stories and your spirit to the rest of the game. Use the_meta( ) template tag to view the custom fields for each posting. A lot of folks put the template tag_meta() at the end of their posts or in their posts meta data section.

All metadata is placed inside the templates tags in a stylesheet named Post-Meta. It is located in a chip named Post-Meta Keys, so you can design it in your own stylesheet. In order to adjust the appearance of the post-meta lists, modify the features in your stylesheet. Google's Custom Field Plugin finder will help you find even more.

In order to enroll custom field assistance within a custom posting style, just enumerate it in your supported $args using custom fields. Below are more sophisticated metadata and custom field retrieval and customization technologies. In order to obtain method parameters, use the command get_post_meta(): try_post_meta ($post_id, $key, $single); $post_id is the ID of the item for which you want to have the method parameters.

This is a character chain containing the name of the desired method name. Setting to True causes the command to retrieve a singular value as a character chain. When wrong or not specified, the command retrieves an arrays of user-defined fields. There are four fields in this table:'meta_id' - A distinct ID for each item.

mail_id' - The ID of the contribution for this tag. Value from this chart is dragged into a multidimensional structure named $post_meta_cache shortly after the $posts matrix is dragged into wp-blog-header.php. Contains only value for the posting lists retrieved for the actual page layout.

So if you wanted to get the "reading" value of postal 256, use this PHP code: Get an army of readings for what I'm currently reading: Returns all the key/value information for the actual contribution. get_post_custom_keys() Returns a full listing of keys for the actual contribution. get_post_custom_values($key) Returns the listing of keys for a specific value for the actual contribution.

get_post_meta ($post_id, $key, $single = false) In WP 1. 5 and higher this feature will return the metainformation without having to deal with memory corruption. It needs the postal ID, the code, and if $single is flagged tru, it will only return the first return (NOT as array) for use in PHP. The resulting value is the resulting value (note the adding of "echo"):

Example: the_meta() Echos an unsorted metadata listing of the actual posting with a UL mailmeta class and LI postmeta keys.

Mehr zum Thema