There is nothing ‘improper’ about the second block of code. Its just written for debugging purposes. The key difference is that that second block used get_the_ID()
. Try that.
add_action ('genesis_before_post_content', 'gteh_tagline');
function gteh_tagline() {
$meta = get_post_meta(get_the_ID(), $field['dbt_text'], true);
echo $meta;
}
Or try to pull in $post
with global
.
add_action ('genesis_before_post_content', 'gteh_tagline');
function gteh_tagline() {
global $post;
$meta = get_post_meta($post->ID, $field['dbt_text'], true);
echo $meta;
}
Or, depending on how that action is written, this might work.
add_action ('genesis_before_post_content', 'gteh_tagline');
function gteh_tagline($post) {
$meta = get_post_meta($post->ID, $field['dbt_text'], true);
echo $meta;
}
Related Posts:
- Displaying Custom Fields on Post with Genesis Child Theme
- Unable to show ACF’s Image Custom Field properly in Genesis Framework [closed]
- Custom Fields Code not echoing whats in the value field
- add_action and remove_action if custom field exists
- author.php not showing content if Author has no Posts
- How can I hide my section title if there is no data in custom fields?
- Query posts by Custom Meta (checkbox) & Genesis Grid Loop
- How to enable custom fields for pages (if not a bad practice)?
- Best way to programmatically remove a category/term from a post
- Add a Jquery Datepicker to custom field in post edit
- Add new “Insert Into Post” button with another function
- Custom per-page sidebar widgets .. possible?
- Multiple meta values for same meta_key adding on “Preview Changes” hit but not on saving or updating post
- How to add new custom page or post blocks?
- Transients vs CRON +Custom Fields: Caching Data Per Post
- How to update serialized data in the user meta data
- Unable to save datetime custom meta field using update_post_meta() function
- Guest Author – How can I use custom fields to create guest author link?
- Create additional short URL with custom field and 301 redirect
- enabling custom fields in admin?
- get_post_meta fields don’t show up on posts page
- how to save multiple custom fields for a post in one go?
- My metabox class
- ACF won’t load from a custom JSON location
- PODS performance vs custom field
- Custom User Profile Fields
- Custom Fields with get_post()
- How do you create dynamic customised sections in WordPress?
- how can i stop custom fields that have apostrophes from breaking my code
- Get specific custom field keys from a post and put into an array
- Importing from XML is ignoring serialized custom field
- How to check for specific meta box value on front end and output accordingly
- Loop to display random posts only if a custom field matches category
- WP Query Returning All Posts
- WordPress User Profile Upload – If page is saved file reset
- How to add field above password section in profile page
- How can I store a file in the database in the same way WordPress and ACF do?
- Custom Field Create Bulk via SQL Query
- How to add an extra field in a post and show it on the template
- Exclude images uploaded via meta boxes from WordPress gallery
- Front-end editing with custom fields?
- If meta key exists in get posts function otherwise create it
- How do i save and retrieve custom attachment meta?
- Show values of dynamically created custom meta keys
- List taxonomy term “Last Name” + “First Name” (taxonomy custom field) in a post loop
- Filter by custom field (meta_key) using JSON API
- Should custom meta boxes be able to output shortcodes the same as WordPress’ native post editor?
- Bulk append custom field to post content
- Custom fields value
- How do I have WP_Query match posts based on search parameter OR meta fields? (rather than search parameters AND meta fields)?
- More efficient to add content to custom fields or the content area?
- Migrating old posts to new wp, how to extrapolate infos from the post body to custom fields?
- Custom field query without duplicates results
- how to display an excerpt of the latest post on the homepage?
- Vimeo thumbnails
- querying a custom field
- Custom post type missing custom fields
- meta_value and meta_key filtering returning no posts [closed]
- Woocommerce Retrieving custom field value from orders
- If one meta key value is empty, try to get another meta key, and if both meta keys are empty show something else?
- Save attachment ID instead of URL in custom field
- If metabox has content display content
- How to change permalink on headlines in rss feeds?
- Listing the most popular 8 city (custom fields) as used in posts
- How to order posts by number of Vimeo Likes
- Displaying a video on the homepage via a custom field inside a php widget
- Displaying custom field meta within WP_query loop
- Custom Field Date Problem
- Approach to creating a site with this structure
- how to create meta key name in wp_usermeta table in database
- Display the output from Custom User Fields from a WordPress user profile on a WordPress Custom Page
- Meta field bulk editing no longer working in WP 6.0 [closed]
- get_field values for each post on home page using wp_add_inline_style
- Delete user meta but only if found in array
- Is there a way to determine which user changed a custom field (and when)?
- Metabox/Custom fields are not saving input data
- meta_query to check all custom fields
- Show image depending on the number in the custom fields
- Show echo ready in single.php
- Save, update, get and sanitize post meta as HTML not plain
- Order categories by sum of custom fields
- how to modify a field’s size in a metabox : ROWS height, and scroll control?
- Saved Post Meta Array Returns as String
- Thirtieth century date for a post
- Saving metadata of related post on save_post
- Custom field in external Javascript
- Custom field value link title
- How to Order Posts by Custom Fields?
- Analyze uploaded images to get colour values
- Turn Current Date in Custom Field Ouput Green or Red
- added a meta box to post however when saving menu while debug on throws a warning
- How can i get the actor birthday by date?
- list pages by custom_field?
- Get custom field from page, in a post?
- Make Custom Fields Public in JSON – API
- Advanced Custom Fields for Header that are Editable from a Page [closed]
- Order by a meta field in query loop
- Truncating characters in Advanced Custom Fields works some places but not others?
- Conditional display based on ACF checkbox
- How to add an ACF only for parent term?