0
사용자 정의 게시 유형에 대해 단일 페이지를 작성하려고하지만 내 방법이 작동하지 않습니다. 나는 모든 항목을 표시하는 쿼리를 만들었사용자 정의 게시 유형 단일 페이지 작성
function portfolio(){
$args = array(
'public' => true,
'label' => __('Portfolio'),
'supports' => array('title', 'editor', 'thumbnail', 'custom-fields'));
register_post_type('portfolio', $args);
register_taxonomy('portfolio', 'portfolio');
}
add_action('init', 'portfolio');
: 나는이 방법으로 사용자 정의 포스트 유형을 만든
<?php
// The Query
$the_query = new WP_Query(array('post_type' => 'portfolio', 'orderby' => 'date', 'order' => 'DESC', 'posts_per_page'=>-1));
// The Loop
while ($the_query->have_posts()) : $the_query->the_post();
$thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id ($the_query->ID), 'thumbnail');
?>
<a href="<?php the_permalink(); ?>" class="col-md-4 item-portfolio">
<img src="<?php echo $thumbnail[0]; ?>" alt="">
<h4><?php the_title(); ?></h4>
<p><?php echo get_post_meta($post->ID, 'subtitle', true); ?></p>
</a>
<?php endwhile; ?>
을 그리고 단일 portfolio.php 파일을 만든 적이 있지만 때 나는 single-portfolio.php 템플리트 대신 index.php가있는 단일 항목으로 이동합니다. 내가 실수 한 곳? 도와 주셔서 감사합니다.
당신이 당신의 테마 나 플러그인에 추가 했습니까? – David
예 function.php에서 function portfolio를 선언하고 index.php에서 쿼리를 사용했습니다. – Zolax