Support

Account

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.