我使用高级自定义字段插件在wordpress页面编辑器中添加Content2和content3。我没有问题没有让它出现在模板中,但现在我想让它出现在另一个页面内容中。 我使用一个名为Allow Php Execute的插件,所以我可以在wordpress编辑器中编写Php。 使用wp_query,我使用“art”类别调用页面,并且我想要显示这些页面的标题,缩略图和内容3。它适用于标题和缩略图,但我无法显示content3自定义字段内容。
这是我的代码,用默认的wordpress内容编辑器编写:
<?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;?>
任何人都可以帮助我吗?
非常感谢你!
雨果