1

Hi i'm using the custom post types UI and advanced custom fields plugin and would like to use the default content editor as one of my fields for a custom post type. When i use the_content(); in the template code to output the content it doesn't work.

  <div class="singleProjectContainer">
      <h1><?php the_title(); ?></h1>
      <p><?php the_field('description'); ?></p>             
      <?php the_content(); ?>
  </div>

Can someone please help me with this. I've searched google but i'm seeing answers related more to content filters.

Advanced Custom Fields Options

1

Be more specific while asking. Asuming you're using WYSIWYG editor in a custom field.

To retrieve custom field value, the_content() won't work. You must use something like this

echo get_post_meta($post_id, 'meta_filed_key',  TRUE);
|improve this answer|||||
  • It is WYSIWYG, not WYGIWYS. Please update your answer. – Pieter Goosen Mar 18 '14 at 10:54
  • @Umi, you should direct your comment at Enthusiast, not me, I just corrected him. – Pieter Goosen Mar 18 '14 at 14:47
  • @Enthusiast Sorry i thought i was quite specific since the content field for Wordpress is a WYSIWYG editor. Advanced Custom Fields gives an option to hide/show the Content Editor when creating custom fields and i chose to show it. I just want to know how to ouput what i wrote in the content WYSIWYG editor – Umi Mar 18 '14 at 15:34
  • Are you telling about "Field Type" drop down which let you choose WYSIWYG/Text area etc? If yes, you'll see a field called "Field Name". Let, the value of field name is "hello_test" So you need echo get_post_meta($post_id, 'hello_test', TRUE); where $post_id is the ID of the post/custom type. You can get ID within loop using $post->ID or outside loop global $post; $post_id = $post->ID; Am I clear? – IFightCode Mar 19 '14 at 7:31
  • @Enthusiast Thanks for the reply, no it is not the "Field Type" drop down. There is a section called "Options" below the area where you fill in a new field, i edited my question by uploading an image showing the Options section so you can have a better idea. I unchecked the 'Content Editor' check box so i can have the regular Wordpress WYSIWYG content field in my custom Post.So i just want to output what is in that Content field,However using the_content() doesn't output anything - that is the problem.Hope my question is clearer now? – Umi Mar 19 '14 at 10:38

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.