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 MoreI 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
1 Answer
Reset to default 0The 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');?>