我有一个名为projectsCPT
的自定义帖子类型,我可以在page-projectsCPT.php
上显示它们
<?php
/*
Template Name: Projects
*/
get_header();
?>
<div class="container" style="padding-top:35px;">
<?php
$args = array( 'post_type' => 'projectsCPT', 'posts_per_page' => 1000, 'orderby' => 'name', 'order' => 'ASC' );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
$meta = get_post_custom($post->ID);
$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];
$projectName = get_post_meta($post->ID, 'vdw_gallery_name', true);
echo '<div class="col-sm-6 col-md-4">';
echo '<div class="panel panel-default">';
echo '<div class="panel-heading">'.$projectName.'</div>';
echo '<div class="panel-body">';
the_post_thumbnail('', array('class' => 'img-responsive', 'href' =>$thumb_url));
echo '</div>';
echo ' <div class="panel-footer"><a class="btn btn-default btn-sm" href="'. get_the_permalink() .'" role="button">More Details</a></div>';
echo '</div>';
echo '</div>';
endwhile;
?>
</div>
<?php
get_footer();
但是
"><a class="btn btn-default btn-sm" href="'. get_the_permalink() .'" role="button">More Details</a>
重定向到404.php
页面!
我有一个single.php
和single-projectsCPT.php
我重复了与page-projectsCPT.php
相同的代码,看它是否有效但仍然可以404.php