最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

custom post types - multiple section

programmeradmin4浏览0评论

I use ACF plugin to add custom post type . but there is a three diffrent sections in my code In first add the main title like our service and in second secton add service items and in third there is a read more button for more service items. How can i solve this. my service items is successfully dynamic but main title and readmore button cant understand how can make dynamic. My code is there :

/assets/images/head.png" alt="#"/> Our Services

'services',); $service_query = new WP_Query( $ser ); if(have_posts() ) : while($service_query->have_posts() ) : $service_query->the_post(); ?> /assets/images/thr.png" alt="#"/>-->

Read More

I use ACF plugin to add custom post type . but there is a three diffrent sections in my code In first add the main title like our service and in second secton add service items and in third there is a read more button for more service items. How can i solve this. my service items is successfully dynamic but main title and readmore button cant understand how can make dynamic. My code is there :

/assets/images/head.png" alt="#"/> Our Services

'services',); $service_query = new WP_Query( $ser ); if(have_posts() ) : while($service_query->have_posts() ) : $service_query->the_post(); ?> /assets/images/thr.png" alt="#"/>-->

Read More

Share Improve this question edited Feb 27, 2020 at 4:25 Ruby asked Feb 26, 2020 at 12:10 RubyRuby 36 bronze badges 2
  • ACF doesn't create custom post types, it creates custom fields. Can you clarify your question a bit? What is it you mean by section, service items, etc, and why are you using WP_Query? – WebElaine Commented Feb 26, 2020 at 15:20
  • I used the ACF plugin and Custom post type ui plugin. I craete a custom post through the Custom post type ui plugin . I attach a file screenshort – Ruby Commented Feb 27, 2020 at 4:27
Add a comment  | 

1 Answer 1

Reset to default 0

The questions seem quite confusing but hope this helps you.

  • If you want to render the main title - use <?php get_the_title(); ?>this help you render the post title.
  • For rendering the post link (permalink) - use <?php echo get_permalink($post->ID);?>
  • For rendering fiedls created through ACF use - <?php echo the_field('slug_of field');?>

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论