michaeluno / admin-page-framework

Facilitates WordPress plugin and theme development.
http://admin-page-framework.michaeluno.jp/
Other
339 stars 71 forks source link

Raw HTML field #171

Closed ghost closed 9 years ago

ghost commented 9 years ago

Hi Michael,

Is it at all possible to have a raw HTML field so that it has no input other than being used for lets say an image or extra description to the bottom of each section? I looked through the documentation and tutorials to see if there was something like this already, but didn't see anything that eluded to this possibility.

michaeluno commented 9 years ago

You can do something like this.

array(
    'field_id'          => 'raw_html_example',
    'title'             => __( 'Raw HTML', 'admin-page-framework-demo' ),
    'type'              => 'my_custom_made_up_non_exisitng_field_type',
    'before_field'      => "<p>This is a custom output inserted with the <code>before_field</code> argument.</p>",
    'after_field'       => "<p>This is a custom output inserted with the <code>after_field</code> argument.</p>",
)

Pass a non-existent field type in the type argument and use the before_field or after_field argument to insert custom outputs.

ghost commented 9 years ago

Fantastic Michael, thank you for a way to do this.

ghost commented 9 years ago

This framework is seriously enjoyable to use.

michaeluno commented 9 years ago

Glad to hear it works and thanks for the nice words!

michaeluno commented 8 years ago

Also as of v3.6.1, the content argument for the section and field definition is available.

array(
...
    'content' => '<p>Your custom contents can be put here.</p>',
...
)