php CPT - 清单(WP)
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php CPT - 清单(WP)相关的知识,希望对你有一定的参考价值。
<?php /* * Template Name: Portfolio */ ?>
<?php get_header(); ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<article class="uk-article">
<?php if (has_post_thumbnail()) : ?>
<?php
$width = get_option('thumbnail_size_w'); //get the width of the thumbnail setting
$height = get_option('thumbnail_size_h'); //get the height of the thumbnail setting
?>
<?php the_post_thumbnail(array($width, $height), array('class' => '')); ?>
<?php endif; ?>
<h1 class="uk-article-title uk-text-center"><i class="uk-icon-bookmark uk-margin-small-right"></i><?php the_title(); ?></h1>
<?php the_content(''); ?>
<br />
</article>
<?php endwhile; ?>
<?php endif; ?>
<?php
// WP_Query arguments
$args = array (
'post_type' => array( 'jdportfolio_cpt' ),
'nopaging' => true,
'posts_per_page' => '-1',
'order' => 'ASC',
'orderby' => 'title',
);
// The Query
$query_test = new WP_Query( $args );
// The Loop
if ( $query_test->have_posts() ) {
?> <section class="uk-grid" data-uk-grid-margin> <?php
while ( $query_test->have_posts() ) {
?> <?php
$query_test->the_post(); ?>
<article class="uk-width-large-1-3" data-uk-scrollspy="{cls:'uk-animation-fade', repeat: true}">
<h3 class="uk-h3 uk-link-muted uk-text-center"><a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
<a class="uk-overlay jd-shadow-img uk-clearfix" href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>">
<?php the_post_thumbnail(array(378, 660), array('class' => 'uk-align-center')); ?>
<div class="uk-overlay-area"></div>
</a>
</article>
<?php
}
?> </section> <?php
} else {
?>
<div class="uk-alert"><h3>Wooops! No se han encontrado entradas</h3><p>Lo siento, en base a tus parámetros de búsqueda no se han encontrado entradas.</p></div>
<?php
}
// Restore original Post Data
wp_reset_postdata();
?>
<?php edit_post_link(__('Edit this post.', 'warp'), '<p><i class="uk-icon-pencil"></i> ','</p>'); ?>
<?php get_footer(); ?>
以上是关于php CPT - 清单(WP)的主要内容,如果未能解决你的问题,请参考以下文章
php WP cpt和分类
php CPT - single-post_type //完整版面(WP)
通过Wordpress循环通过ID循环CPT
WP-突出显示导航项,用于自定义post类型存档和单个
html [WP filler]占位符内容,用于测试page / post / cpt中的大多数主题元素
CPT(自定义Post类型)提要短代码