Using If to display a message if no post assigned to a category

Ok, so I figured out a workaround to my previous issue, but a new one has cropped up.

I want to display a message if my loop returns no posts, however I cannot figure out where or what to put as a If statement.

I just want my code to execute if at least one post has the appropriate state category assigned it, but if no posts exists I want it to display a message.

My current code is below, any assistance is appreciated.

<div class="loan-officer__grid">
<Loop type=loan-officer taxonomy=licensed-state terms="{Field choose_state}" orderby=title>
  <div class="findofficer">
	<div class="fo-column-left">
		<div class="fo-featuredimg">
      <Field image size="medium" alt="{Field image_alt}"/>
	<div class="fo-column-right">
		<div class="fo-info">
			<h2><Field title /></h2>
			<h4><Field acf_text="title" /> | NMLS #<Field acf_number="nmls_#" /></h4>
				<span class="fo-designator">Phone:</span> <span class="fo-officerinfo"><Field acf_text="phone_number" /></span>
				<span class="fo-designator">Email:</span> <span class="fo-officerinfo"><a href="mailto:{Field email_address}"><Field acf_email="email_address" /></a></span>
			<div class="fo-buttonbox">
				<span class="fo-button"><Shortcode>[wpbb post:link text="custom" custom_text="View Officer Info"]</Shortcode></span>

Hi Anthony,

This documentation should help:

1 Like