我基本上是以某种方式创建一个循环,以便根据它的ID显示单个自定义帖子类型的内容。在Wordpress中通过ID获取自定义帖子的类型
所以,我想从自定义后类型与3788.
的ID内容书中有一个函数来获取图像功能太URL。
例如,这里是我的代码的时刻:
<?php $args = array('post_type' => 'about', 'posts_per_page' => 1); ?>
<?php $loop = new WP_Query($args); ?>
<?php while ($loop->have_posts()) : $loop->the_post(); ?>
<?php global $post; ?>
<?php
$src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), array(5600,1000), false, ''); ?>
<div class="section" style="background: url(<?php echo $src[0]; ?>) no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; z-index:-1;">
<?php the_content() ?>
<?php endwhile; ?>
请告诉我你的问题?什么代码行不适合你? –
这并不是说它不起作用,而是它不会做我需要的。我需要从“关于”拉一篇文章,而不是从那里发布每篇文章。 – user3181828
您是在谈论邮政类别'about'还是您为仪表板创建了一个自定义邮政类型'about'? – designtocode