0
我已经把这个代码滑块来显示帖子拿起用户选择类别的类别,但添加此代码后,它不会选择后自定义字段例如或任何其他的PHP代码甚至我试过..需要帮助的PHP代码创建错误wordpress自定义字段
这里是我申请
<div class="blog-posts-slider">
<?php $temp_query = $wp_query;
$category_name = get_field('business_solutions_category_name');
query_posts(array(
'category_name' => $category_name,
'posts_per_page' => 5
)
);
while (have_posts()) : the_post();
$thumb_id = get_post_thumbnail_id();
$thumb_url_array = wp_get_attachment_image_src($thumb_id, 'thumbnail-size', true);
$thumb_url = $thumb_url_array[0];
?>
<div class="slider-single-post">
<div class="blog-image" style="background-image : url('<?php the_post_thumbnail_url(); ?>');"></div>
<div class="slider-post-text">
<h3><?php the_title(); ?></h3>
<p><?php the_excerpt(); ?></p>
<a href="<?php the_permalink(); ?>">Read More</a>
</div>
</div>
<?php endwhile;
$wp_query = $temp_query; ?>
</div>
的代码我不熟悉,许多用PHP ..但我认为这是对ENDWHILE或线下的错误...我缺少的东西.. 在此先感谢。
对不起,我没有得到你.. 我有错误使用的东西吗? 和我用get_field('business_solutions_category_name'); 以获取我使用该插件的自定义字段插件(FIELD)的值。 我结束循环是否正确? – emppeak
你有没有试过get_post_custom($ post_id)? –
警告:urlencode()期望parameter1是字符串。 这是我现在得到的错误,之后的代码。 – emppeak