我想知道是否有人可以提供解决方案来解决我在我的网页上显示的afc图片字段的问题。我添加了一个自定义字段并上传了图片,但是调用该图片不起作用。我的代码如下...
<?php
$i = 1;
$args = array( 'posts_per_page' => 4);
$category_posts = new WP_Query($args);
if($category_posts->have_posts()) :
while($category_posts->have_posts()) :
$category_posts->the_post();
$link = get_the_permalink();
$feat = get_field('home-image',$post->ID);
$paw = get_the_post_thumbnail($post->ID, 'featured-thumb');
$paw2 = get_the_post_thumbnail($post->ID, 'featured-thumb');
$paw3 = get_the_post_thumbnail($post->ID, 'featured-thumb');
if ($i === 1) {
echo '<div class="featured-article"><a href="'.$link.'"><h2>Our latest news & events</h2><div class="tag-title"><div class="feat-tag">FEATURED</div><h3>'.get_the_title().'</h3></div>'.$feat.'</a></div>';
}
else {
if ($i === 2) {
echo '<div class="small-container">';
}
if ($i == 2) {
echo '<div class="one-third small-blog-item article-'.$i.'"><a href="'.$link.'"><div class="paw">'.$paw2.'</div><h3>'.get_the_title().'</h3></a></div>';
}
if ($i == 3) {
echo '<div class="one-third small-blog-item article-'.$i.'"><a href="'.$link.'"><div class="paw">'.$paw.'</div><h3>'.get_the_title().'</h3></a></div>';
}
if ($i == 4) {
echo '<div class="one-third small-blog-item article-'.$i.'"><a href="'.$link.'"><div class="paw">'.$paw2.'</div><h3>'.get_the_title().'</h3></a></div>';
}
if ($i === 4) {
echo '</div>';
}
}
$i++
?>