This is a php logic / variable issue. You output $fullname
whether or not it has been set inside that iteration’s foreach
. So for projects that never enter the foreach
to set $fullname
, it still contains whatever the last iteration had set it to. Set it to an empty string before the foreach
so it only contains a name if it enters the foreach
.
Related Posts:
- Very Slow Page – How to Optimize # of Queries?
- How to make sure content doesn’t display if selection is empty
- How can I group posts by months and years?
- Loop increase number
- Using wp_query to modify the loop in index.php for a CPT
- Page that lists publications by classifying them by taxonomy
- WordPress loop add heading before first of type
- How to make a shortcode for my WP_Query Loop? [duplicate]
- Strange behavior on WP_query
- get_post_meta for Custom Post Type ( CPT )
- Query Custom Post Type by Tag
- How do you get the count of posts in an archive page?
- List events by month
- WP_Query on custom post type not displaying, multiple loops & get_template_part
- Using new WP_Query in shortcode in a custom field causes the main post content to not display
- Custom post type loops with different page templates
- How to create posts (not post template) to be displayed on projects page?
- WP_Query post at custom position
- Should unaltered default loop/query return a list of custom posts belonging to a custom taxonomy?
- Adding a span when custom post type is updated
- exclude custom post type by meta key in wp_query
- Query for posts in 2 taxonomies
- How do I Use Nested Loops of Custom Post Types for MultiSite Blogs using WP_Query()
- Impossible to get Attachments Outside WordPress?
- WP_Query search posts by custom post type and custom taxonomy
- Unable to get post content from custom post type loop
- Help Structuring Query for Archive Pages
- Display custom field of specific post where post title matches variable
- wp_query to find posts by year and month
- Remove duplicated values from a loop
- Custom Post Type Loop within Shortcode
- How to connect two custom post types with nested loops
- wpdb custom post_type problem
- Query custom post type in the loop
- Display CPT posts based on specific taxonomy
- Custom Post Type Loop throws 500 error when used in widget
- Show one item per category of a custom post type
- CPT + CMB2: data not displaying for only first post in loop
- convert custom query to wp_query
- Custom Tag Description unable to display just below and outside of the Loop
- WP Query with categories only shows one post and ignores the category
- Problem: wp_query outputs all images on site
- Configuring a meta query with multiple post types that have the same relationship on a single page
- Wrapping x posts in html without leaving empty html
- Sort posts in loop by the WooCommerce Membership of the author
- Custom WP_Query doesn’t display all posts
- Query & the_content() is showing in the header
- Is This Code Efficient – Or is there a better way?
- Pagination not working on custom query on a page
- Get data from PHP to JavaScript to set position of each post on front page
- Undefined $post in wp_query
- display posts of custom post type with custom taxonomy
- Custom post type and custom taxonomy 404 on page 2
- List latest post out of 2 custom post types
- How to fetch posts that are stored in the different table than (default) wp_posts?
- Cant’ Display Custom Post Type Title Base on Tax Terms
- How do I list a custom field and custom taxonomies for each result in a loop?
- Custom Post Type Query W/Category Dropdown
- Query for specific taxonomy that executes a particular loop depending on volume of posts?
- Show the categories the current post has
- What is the most efficient way to execute recursive complex queries?
- Fetch data from two custom post types and create multidimensional array for output to html table
- CPT loop doesn’t seem to account for post date?
- set object terms after some some time of published post – functions.php
- See if the email exists or not
- Alike Shortcode using in Custom Shortcode
- Query custom post type that has a serialized relational advanced custom field value
- Pin posts to top of custom loop
- Pagination not working in custom post type. Help
- Sort custom post column by generated value?
- WP_Query – How To Query Only Custom Posts With No Children of Their Own?
- Accessing download link from the loop with WP Download Manager Pro
- Combine multiple separate lists into one
- Custom meta fields not showing up in WP_Response Object via custom endpoint
- Tell wordpress to show a single page instead of an archive page
- Wrapping an unknown amount of posts inside separate HTML Containers during WP_Query loop
- Custom Taxonomy – fields
- WordPress trying to query two custom types to get child from the parent
- sorting in wp query based on custom field value
- Custom post Query and WordPress Post Query Clash
- Add active class to foundation 6 tabs while looping categories
- CPT post doesnt shows tags and category on backend admin page
- How to use costum database table for custom post type
- WordPress query in which condition uses custom field
- Only show current category post
- Error in WP Query. If variable is empty it is displaying previous post value
- WordPress query posts by custom post type not workng
- Is it possible to add query parameters on the archive page?
- How can I pull information from my loop and divide them seperately?
- Order by custom field attribute
- WordPress multi-query not returning as expected
- Fallback if statement based on the number filtered from it
- Custom Post-type not returning the right child_of
- next_posts_link returns same content of 1st page
- Custom loop won’t work, can’t find problem
- Fourth page of custom post type archive page does not exist
- Catergory args causing loop not to show
- How to exclude certain portfolios from a loop
- How to insert a post from a different post type after every nth post
- Complex Custom Loop with Includes