you can change you code a bit :
$taxonomy = 'country';
$terms=get_the_terms($post->ID,$taxonomy);
if($terms) {
echo '<h1>Holiday ';
$total_count = count($terms);
$country_count = 1;
foreach( $terms as $termcountry ) {
if ($country_count = 1){
echo 'in '.$termcountry->name;
}else{
if ($total_count = 2){
echo ' And '.$termcountry->name;
}else{
echo ', '.$termcountry->name;
}
}
$country_count = $country_count + 1 ;
}
echo '</h1>';
}
This will output in case of one term:
<h1>Holiday in Spain</h1>
in case of two terms:
<h1>Holiday in Spain And Japan</h1>
and in case of more then two terms:
<h1>Holiday in Spain, Japan, England</h1>
hope this helps
Related Posts:
- What does this PHP function code mean? [closed]
- Restrict custom post type to only site administrator role
- Linking Two Post Types
- How to force one column layout on custom post type edit page?
- modify all posts of a category to “no comments allowed”
- How to hook get_terms() to only show count of posts that have custom meta
- Why is the »_builtin« parameter not advised in »register_post_type()« for custom post types?
- Showing current taxonomy terms
- automatically create taxonomy with same name as post title
- Assigning a role to a specific custom post type (and ignoring other post types)
- Display posts in random post types
- Custom Post Type by user
- saving custom post type data to different table in wordpress
- Query post types with multiple keys
- [Plugin: Posts 2 Posts] Changing display order of connections
- same archive template for different custom post
- Get all posts WHERE custom_field is LIKE value
- Get the post children count of a post
- How to delete all posts from a custom post type?
- Check Title Unique Or Not and If not error message and dont save
- How to filter the taxonomy terms based on another taxonomy term
- Remove All, Published and Trashed Post Views in Custom Post Type
- How to post twitter like updates on wordpress
- Show Two custom Post type and their posts on category page
- apply filters only to specific post listing without check the url parameters
- Custom post type and body_class: Remove “blog” class
- Deleting Custom Post type data using mySQL command
- Is there a way to have the view link on manage posts page to open in a new window or tab?
- Display only one post each WEEK
- Which post does a taxonomy term belongs to?
- List custom taxonomy specific to one custom post type
- Meta query for custom post type ignored in main query
- Show titles, date of all posts on single category page
- Update postmeta Parent when post_status child change
- How to include term custom meta into the custom taxonomy term permalink structure
- Allow users to create posts without logging in?
- How to sort posts in a custom post type by title in ascending order by default?
- How to Display Posts From Category Within a Custom Taxonomy?
- Custom post type menu
- YOAST SEO won’t work on custom post type archive [closed]
- Separate Content from gallery (custom post type)
- WordPress Count posts within a custom post type
- Get terms for a specfic post from multiple taxonomies in custom post type
- Custom post type tags not showing in search
- How to list posts by term (custom taxonomy)
- Custom taxonomy not saving correctly
- How set template for “custom post type” individual post
- Why is my custom post content only viewable when signed into WordPress?
- Adding specific custom fields (images) to post excerpt
- Limit posts per page depending on the size of a div?
- Display title of all custom posts from same taxonomy term on a custom post template
- Delete Post by User
- How to get all posts related to a taxonomy?
- creating a custom post template
- Filter By Term Not Working – Custom Post Type
- Problem to get the link of the default ‘post’ post type like the orther custom types
- One Post with different content, depending on a Page
- Custom Post Type
- Custom Post Status & Taxonomies
- Display all post types together
- Using get_terms() as shortcode attribute
- Turn post into simple slideshow
- Query multiple post of which one by taxonomy
- How to make a template for a specific post of a custom post type?
- How to delete unnecessary custom post types in the UI
- How to create a job post by email parsing? [closed]
- show posts under custom post type with same autj
- How to automate the creation of advanced layout article/post
- display posts, pages and custom post types from another wordpress site
- is therer any wordpress function to retrieve a specific html element from post content
- How to develop Knowledge center in WordPress Website
- ACF – Tags not showing up in Custom Post Types
- Get the ID of the latest post
- Change permalinks for posts but not for custom post types
- Front end post editing using a form
- How do I list custom taxonomy terms without the links?
- WP 3.1 – archive pages for custom content types possible now without a plugin?
- Getting a div content of a post in wordpress?
- display multiple term post from taxonomy in a single page
- How to not allow custom roles to edit published custom post types?
- Assign Page Template Within A Custom Post Type
- Custom permalinks – post type – hierarchical taxonomy’s
- add_meta_box: Datepicker like the one for postdate?
- How to show post title outside of loop? [closed]
- How do you use JavaScript to detect the homepage
- Error after deleting Custom Post Type with a function (no trash used)
- Saving repeated option values in a custom query
- CPT’s archive and single page not working [closed]
- How to customize admin posts based on the user who is logged in
- Custom Post Type | Fatal Error on register_post_type()
- How to output wordpress custom tags separated by comma?
- Dynamically add / duplicate custom meta in custom post types
- How can I create a custom meta box to add an mp4 video to a page?
- Custom post type menu missing after 3.0b2 -> 3.1.2 upgrade
- Get posts of ONE taxonomy term of custom post type
- Define new user capability for custom post types?
- Post image in WordPress not appearing on home page
- How to handle paged param in post and custom-post-type?
- Shortcode to display Staff post type based on Location post type and Specialty post type
- Foreach inside shortcode not working as planned