You can find out the post format using get_post_format()
. So try adding your textarea custom field in a custom metabox library file, and then do the following:
if( 'video' == get_post_format( $post->ID ) ) {
include_once( get_stylesheet_directory_uri() . '/path-to-cmb-library/video-metabox-file.php' );
}
This assumes that you’re in The Loop or that you have a WordPress Post object in $post
.
Related Posts:
- Is there a way to set default custom fields when creating a post?
- Pre-filling custom fields on New Post
- So much data in postmeta
- Show only posts which can be commented OR have custom meta field
- Make Custom Field Into A Link On The Front End?
- Show Custom Comment Fields when editing in admin
- How do I make a custom field choose an image?
- get_post_meta() unserialize issue – returns boolean(false)
- How can I remove fields in the attachment editor?
- Why isn’t my code to save custom fields in quick edit working?
- Edit Custom Database Tables in WordPress
- Custom Meta Boxes: Store two values in one repeatable field
- Gutenberg Custom Block
- Up/Down voting system for WordPress
- Custom Meta Field not Working with qTranslate [closed]
- Change content before writing to database
- post meta data clearing on autosave
- WordPress Search Custom Meta Field Only
- Problem in custom meta boxes
- Loop through two different sets of custom fields
- Query Problem – Show posts within category ‘x’ that have a custom field between ‘y’ and ‘z’
- Add description text under input field for new profile fields
- Metabox with multiple fields added by user and upload box
- Which is best in the following scenario : post_meta vs custom table vs parent/child posts
- Get all meta keys assigned to a post type
- How to add content at the end of posts?
- sort search results by custom fields using dropdown
- WP Custom Fields Metabox Disappears – ACF plugin issue [closed]
- Get all posts that do not have a specific custom field without using a subquery
- How to query posts with certain custom meta data, and output Post data
- Custom Fields Not in Search Results
- How to loop through certain custom field values
- add_action and remove_action if custom field exists
- wordpress custom fields multiple data
- Add post meta fields, when creating a post using WordPress’ REST API
- Store array as single, serialized post meta field or many post meta fields?
- Get an advanced custom field after post publish
- Why the pagination for a query modified by pre_get_posts doesn’t mind the number & order of posts sorted & selected based on a custom date time field
- update_post_meta for repeated custom field [closed]
- Trying to update_post_meta function
- How do i add custom fields to my themes template file?
- Custom Field to a Role?
- Trying to reorder posts by custom field
- Delete custom fields when deleting posts
- Pull custom fields from custom posts within a loop
- Ordering posts by custom field named “date” in backend
- How to pass page as an argument like post in WordPress?
- How to display custom fields from a plugin
- Link the retrieved custom field values to its respective posts
- Sortable custom field values from all posts on a page template
- Adding “meta” info to WP site PHP function?
- WordPress Media Uploader custom Javascript not working
- Custom fields issue [closed]
- Select custom posts by meta_value and sort by a different meta value
- List custom queried terms in the edit-tags.php?taxonomy page
- Values entered in a meta box aren’t saved
- Display meta box dropdown (from custom post type) in the page post type
- Front end register with custom fields
- How to Make Post Custom Column Editable
- how can I show name and value of Custom Fields together?
- Adding simple (one button) Audio player using Custom Fields?
- Display custom field from the front page on another page
- No result update a custom field using wp_schedule_event
- Display custom widget value in header.php
- Gravity Forms Update post meta from template [closed]
- Automatic linking terms
- Is it possible to compare the current time with a custom “start” and “end date
- Display metabox title for custom fields with values
- wpdb function insert doesn’t work
- Get Custom Field Name ( Label or Key ) Not Value
- Adding Custom Metadata to my Archive/Posts page
- Ordering by ACF custom field vaule
- add different custom fields value to post class if permalink or index
- User Filter Options on Archive Page
- Create Shortcode shows only posts with custom_field meta
- Login_form add to top of form rather then bottom
- Advanced Custom Fields from Category – IF statement
- Search one custom field?
- Can’t save meta field value if the title not set
- Get a different meta value with ajax when different elements are clicked
- Delete custom fields on post publish?
- Why is wp_list_pages altering $post->ID of the page?
- How do you turn a custom field’s value into a permalink for that post?
- Permalink structure depending on custom field
- How to keep sharing stats after creating 301 redirects?
- Using Hooks. Thematic
- Insert wp gallery shortcode into custom textarea
- Display posts where date field matches current month?
- Parse Shortcodes in Theme’s Custom Field?
- Update field name without losing the value
- Add values of post meta fields?
- How do delete a meta key?
- Google not index my Custom 404 page ?why?
- How can i put a custom field inside this php
- Dynamically update Custom Fields to display new dates
- Add fields to edit in custom widget
- save all acf options in one meta_value [closed]
- Can running a WP-Cron to update_post_meta cause performance issues?
- custom field value is blank or empty
- How to add a custom field to the comments “Quick Edit” screen?