You are trying to echo within a variable. You also have encapsulated PHP tags in the string as well. You need to concatenate just the functions themselves like this:
function default_content($content) {
global $post;
if ($post->post_type == 'my-custom-post-type') {
$content .= '<p style="text-align: center;"><strong>Custom Field Text here: '. get_post_meta( $post->ID, "custom-field-1", true ).'</strong></p>
<p style="text-align: center;"><a href="http://myblog.com/?checkout=" . get_post_meta( $post->ID, "custom-field-2", true )."">Link 01</a></p>';
}
return $content;
}
add_filter('the_content', 'default_content', 0);
Also you are calling global $post, so use $post->ID instead of get_the_ID().
Cheers!
Related Posts:
- Add filter menu to admin list of posts (of custom type) to filter posts by custom field values
- Is there any action filter/hook for validating a custom field before publishing the post?
- Filter WP_Query for posts having a certain meta-value
- Apply the_content filter to a custom field with multiple values
- Pass all custom fields through the same filter on post load?
- WP doesn’t show Array Custom Fields?
- Add new “Insert Into Post” button with another function
- Filter results with custom field values and dropdown
- Add meta data to the menu
- Archive sorting functions by custom fields (front-end)
- can you set a default value to a custom field
- Guest Author – How can I use custom fields to create guest author link?
- Change content before writing to database
- post meta data clearing on autosave
- WordPress Search Custom Meta Field Only
- How do I assign this filter to a variable? (Appending php & markup to the_content)
- Using custom fields in a filter hook
- Add an advert every nth Paragraph
- Add input field to ‘Pages > Edit Page’ through functions.php
- How to filter a dd/mm/yyyy date from a custom field in a query
- Auto-add paragraphs to custom field?
- Add description text under input field for new profile fields
- How to add a predefined custom field without using a plugin?
- Populate Custom Field Dropdown on Theme Install?
- Force hide custom field metaboxes
- Saving custom profile fields
- How to add content at the end of posts?
- Update posts after populating ACF field value [closed]
- How to validate custom field on lost password form before the user id field?
- how to put a custom field value in variable
- Auto Populate Custom Field with Complex Value That Increase by One?
- filtering custom post types via meta data drop down
- global function to apply filter to custom field
- Custom Metabox Not Saving
- Getting the ID of any image for use in functions.php
- Auto-remove custom field with no value on publish
- Display custom field values from posts on frontpage
- How to order posts by one custom field and filter them by another one?
- Filter multiple custom fields Values with Check boxes
- How to get categories with posts by custom field value?
- Redirect to another page using contact form 7? [closed]
- How to Wrote Simple Calculations by Using Custom Fields in Loop?
- Specific coditional usage [closed]
- Best filter to use for modifying custom fields on a post?
- How to display childrens custom fields?
- Hide custom fields when empty
- How to disable Edit Post and Allow only Custom Field?
- Access ACF fields within custom preview function?
- Sort posts by clicks on download button
- Let Users Filter Posts by Custom Fields
- Custom Theme Fields in Settings Menu – apply filters to one of those fields?
- Footnotes in custom fields
- Custom metabox not working
- How to change permalink on headlines in rss feeds?
- How to change order of posts in admin
- Stripping and/or altering the content of a custom field (video URL)
- How to query posts by month based on date custom field?
- Odd functions.php issue in WordPress
- Filter or order based on custom field
- How to show ACF fields in Gridbuilder custom block
- WP meta_query args not working in function
- User Filter Options on Archive Page
- How to add content with a filter when there’s no content in the editor
- change attachment custom field onChange event
- Filter and display a specific custom field value [closed]
- How to filter post using custom feild value in shortest and longest duration?
- Query Posts Via WordPress URL
- Create widget that filters posts on current page based on entered value
- Meta boxes not displayed, data isn’t being saved
- Calling Custom Field within Function wrapped with Divs.
- Get fields from metabox array
- Sort posts after filtering them through multiple taxonomies
- How to automatically create a custom field when a post is published?
- Set new url from custom post field
- How to pass value to add_filter wpcf7_form_tag from another function?
- Remove Actions/Filters added via Anonymous Functions
- Set media upload attachment link to none and hide it in WP v3.5
- How to save custom fields for attachments
- How to get a meta value from all post
- Exclude custom post type from search by custom field value?
- Override a class function to include a custom template
- custom avatar removal
- Is possible add icon in title posts only in specific tag?
- Filtering a function’ output for a new continued function
- Displaying custom filed content instead of post content
- Save all the post tags inside a custom field
- How to update a custom field in all posts with the value of another custom field in the same post?
- Set featured image from custom field URL
- Best Way to get facebook share count and update using wp_schedule_event or any other method
- Filter posts by custom field (Advanced Custom Fields)
- Custom meta fields and meta keys
- HTML for adding a meta box (basic text field) to page editor?
- use custom field value as featured image
- adding autosave feature to custom fields
- Create custom query for search?
- Updating custom fields with external data
- How to disable ‘enclosure’ custom field link from appearing in the post
- Help sorting by Meta Key value
- Custom classes for attachments
- Show/Hide Featured Image or replace it with custom field [closed]