admin管理员组文章数量:1313240
I have created a custom post type ui with custom field.
Here is my code:
<?php
/*
Template Name: Diseases & Conditions
*/
?>
<?php get_header(); ?>
<div class="section inner-cont">
<div class="container">
<div class="row">
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="col-sm-12">
<div class="main-title">
<h1><?php the_title(); ?></h1>
</div>
<div class="card-text">
<?php endwhile; ?>
<?php endif; wp_reset_postdata(); ?>
<?php $mydiseases = new WP_Query(array(
'post_type' => 'diseases_condition'
)); ?>
<?php while( $mydiseases -> have_post() ) : $mydiseases -> the_post(); ?>
<div class="row">
<div class="col-sm-12">
<?php the_title(); ?>
<?php the_post_thumbnail();?>
<div class="card-text">
<?php the_excerpt(); ?>
</div>
<div class="card-btn">
<a href="<?php the_permalink() ?>" class="btn btn-primary">read more</a>
</div>
</div>
</div>
<?php endwhile; ?>
</div>
</div>
</div>
</div>
</div>
<?php get_footer(); ?>
But my page is not showing custom post-type details, as like thumbnail, excerpt, Title etc...
Here is Screenshot
I want to add those into a new page. How can I do this?
I have created a custom post type ui with custom field.
Here is my code:
<?php
/*
Template Name: Diseases & Conditions
*/
?>
<?php get_header(); ?>
<div class="section inner-cont">
<div class="container">
<div class="row">
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="col-sm-12">
<div class="main-title">
<h1><?php the_title(); ?></h1>
</div>
<div class="card-text">
<?php endwhile; ?>
<?php endif; wp_reset_postdata(); ?>
<?php $mydiseases = new WP_Query(array(
'post_type' => 'diseases_condition'
)); ?>
<?php while( $mydiseases -> have_post() ) : $mydiseases -> the_post(); ?>
<div class="row">
<div class="col-sm-12">
<?php the_title(); ?>
<?php the_post_thumbnail();?>
<div class="card-text">
<?php the_excerpt(); ?>
</div>
<div class="card-btn">
<a href="<?php the_permalink() ?>" class="btn btn-primary">read more</a>
</div>
</div>
</div>
<?php endwhile; ?>
</div>
</div>
</div>
</div>
</div>
<?php get_footer(); ?>
But my page is not showing custom post-type details, as like thumbnail, excerpt, Title etc...
Here is Screenshot
I want to add those into a new page. How can I do this?
Share Improve this question edited Dec 1, 2020 at 2:16 admcfajn 1,3262 gold badges13 silver badges30 bronze badges asked Dec 30, 2017 at 14:18 Pixelnav AdminPixelnav Admin 1 2 |1 Answer
Reset to default 1Have you linked the acf-fields to the post-types? then just call echo get_field('your_field_name_here') ;
from inside the loop. or echo get_field('your_field_name_here', 'id_or_something') ;
from outside the loop.
本文标签: Custom Post Type UI with ACF
版权声明:本文标题:Custom Post Type UI with ACF 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741949834a2406644.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
have_post()
is not a function, it'shave_posts()
. – Milo Commented Dec 30, 2017 at 15:43