0

i'm new in php and want to show page content into a div. The call of the content is using function, here is my code but it doesnt works, how can I fix it?

function fields_after_order_details(){
  echo '<div class="tandc">'.
      $my_id = 2731;
      $post_id_2731 = get_post($my_id, ARRAY_A);
      $title = $post_id_2731['post_content'];
    .'</div>';
}
  • What is ARRAY_A? – mrben522 Jun 14 '17 at 16:49
0

I'm not sure what ARRAY_A is supposed to be, seems unnecessary unless there's more info we're missing. Also, get_post returns an object, not an array. Try this:

function fields_after_order_details(){
  $my_id = 2731;
  $post_id_2731 = get_post($my_id);
  $title = $post_id_2731->post_content;
  echo '<div class="tandc">' . $title . '</div>';

}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.