Home › Forums › General Issues › Replacing the_content with custom fields › Reply To: Replacing the_content with custom fields
Well first you’ll want to replace
if(get_post_type($post_id) == 'your specific post type'){
“your specific post type” with the actual post type slug.
Then you want to add in all of your fields in the right order to the new_content variable:
$new_content .= 'this is the beginning of the content and heres my first field'. $fields['fieldname']['value'] . '. Doesnt it look marvelous!';
$new_content .= ' Here's some more stuff added on to the content:'. $fields['fieldname']['value'] . ' and ' . $fields['fieldname']['value'];
The problem is that I don’t know what the $fields variable look like so in order for you to find out you can do this:
print_r($fields);
die();
put it right after
$fields = $_POST['fields'];
when you save a post you’ll get a blank screen with the values of $fields.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.