2015年1月29日 星期四

Understanding WordPress Customized Meta Field


Within the earlier publish, we’ve talked concerning the WordPress custom field, which lets you add and output a brand new entry in a publish utilizing the Customized Area field that WordPress supplies within the submit modifying display. If nevertheless you aren’t snug utilizing the customized subject field (all of us have our particular person preferences), this is an alternate: you’ll be able to create a meta field.


A meta field is a custom-made field that we create on our personal, which can include enter or different interactive UI so as to add new entries of posts or pages. You need to use the meta field as an alternative of the Customized Subject field to do the identical factor. Let’s examine the right way to create one.


Extra on Hongkiat.com:



Making a Meta Field


WordPress providse an API perform, referred to as add_meta_box, which lets us create a meta field right away. That is it in its utmost primary type.



perform add_post_reference() add_meta_box('publish-reference', 'Reference', 'referenceCallBack', 'publish'); add_action('add_meta_boxes', 'add_post_reference'); perform referenceCallBack() echo 'Howdy World'

The add_meta_box takes 4 parameters: the ID, the meta field title, a callback function that may name out ‘Good day World’, and the submit sort we need to show. On this case we assign a brand new meta field in a publish modifying web page (this additionally works with pages).


Within the publish modifying part, you will discover a brand new field, as follows.


The brand new meta field, as you’ll be able to see above, would seem under the WYSIWYG editor. If you wish to add it within the sidebar you possibly can add ‘aspect’ after the publish parameter,


The post Understanding WordPress Customized Meta Field appeared first on DICKLEUNG DESIGN 2014.


沒有留言: