I use Advanced Custom Field plugin to add Content2 and content3 in wordpress page editor. I have no problem no make it appear in a template, but now I would like to make it appear in another page content.
I use a plugin called Allow Php Execute so I can write Php in wordpress editor.
With a wp_query I call the pages with category “art”, and I want to make appear the title, the thumbnail and the content3 of those pages. It works well with title and thumbnail, but I can’t display the content3 custom field content.

Here is my code, written in the default wordpress content editor :

<?php 
$the_query = new WP_Query( 'category_name=arts-plastiques','orderby=modified'); ?>
<?php while ($the_query -> have_posts()) : $the_query -> the_post();  ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

	<div class="entry-content-page2Col">
        <div class="col_gauche">
		<div class="col_gauche_content"><?php the_post_thumbnail($size = 'full-size'); ?>	</div>
		</div>
					
		<div class="col_droite">
		<div class="col_droite_content">
		<h2><div class="titrePage"><?php the_title(); ?></div></h2>
		<div><?php
$post = $the_query->post->ID;
echo get_post_meta($post, 'colonne_3', true);
wp_reset_query();
?></div>
		<div class="more"><a href="<?php the_permalink(); ?>">En savoir plus</a></div>
		</div>
	</div><!-- .entry-content -->
</article><!-- #post-## -->
<?php endwhile;?>

Can anyone help me ?

Thank you a lot !

Hugo

Read more here: Show advanced custom field content


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: