Tagged: 

Viewing 4 reply threads
  • Author
    Posts
    • #1857
      kattagami
      Member

      Hello,

      For a specific role, I need my CPT’s content to be in a “read only” mode.
      To do that, I’ve hided the content editor and I’ve tempted to display the CPT’s content in a Piklist meta box with a classic loop :

      
      if ( have_posts() ) {
      		while ( have_posts() ) {
      			the_post(); 
      			
      			// CPT Content
      			the_content();
      		} 
      	} 
      

      Unfortunately, it doesn’t works.
      If I try with the_title() it works even out the loop.

      Does someone has an idea to do that?

    • #1858
      kattagami
      Member

      Ok I’ve found, be careful the solution is complex :

      echo $post->post_content;
      
    • #1926
      zanedickens
      Member

      Hi Kattagami,

      I need to do the same thing – how do you actually put that little bit of code into a Metabox?

      *Learning Piklist and PHP as I go on this project so please excuse any glaring ignorance on my part.

      Thanks in advance!

    • #1929
      cmwwebfx
      Member

      I think this is what you are looking for Kattagami.

      if ( have_posts() ) {
      		while ( have_posts() ) {
      			the_post(); 
      			
      			// CPT Content
      			echo $post->post_content;
      		} 
      	} 
    • #1978
      kattagami
      Member

      No need to wrap the “echo $post->post_content;” in a loop.

      Just copy/past this line in your piklist-metabox.php: echo $post->post_content;

Viewing 4 reply threads
  • The topic ‘Display the_content in a metabox’ is closed to new replies.