title: PHP - adding function to string
body: <p>I'm relatively new to PHP and don't even really know how to ask the question for which i need help with, so please excuse my lack of technical knowledge - or referring to terms correctly for that matter. </p>
  
  <p>I cannot figure out a way to add the "if(function_exists("the_ratings"))" code below to a string as in the PHP i have below. I know that the way it is below is not correct, but i've placed it there to show how and where i need it to display - help is greatly appreciated.</p>
  
  <pre><code>function latestreleases()   {
  
  $args = array( 'posts_per_page' =&gt; 30, 'cat' =&gt; '-1, -2' );                  
  $last_5_posts_query = new WP_Query( $args );
  while($last_5_posts_query-&gt;have_posts()) : 
      $last_5_posts_query-&gt;the_post();
      $link = get_permalink();
      $title = get_the_title();
      $description = excerpt(16);
      $details = 'Watch ';
      $readmore = 'Read more...';                  
  
      $content .= '&lt;div class="all-latest-movies"&gt;';
      $content .= '&lt;h3&gt;&lt;a href='.$link.' target="_top"&gt;'.$title.'&lt;/a&gt;&lt;/h3&gt;';
      $content .= '&lt;div class="thumbnail"&gt;&lt;a href=" '.$link. ' "&gt;'
      . get_the_post_thumbnail( null, "home-movie-thumbnail") 
      . '&lt;/a&gt;&lt;/div&gt;';
      $content .= '&lt;div class="description"&gt;' .$description. '&amp;nbsp;&lt;a href= '.$link.' &gt;' .$readmore. '&lt;/div&gt;';
      $content .= '&lt;div class="view-listing"&gt;&lt;a href= '.$link.' target="_blank" &gt;' .$details. $title. '&lt;/a&gt;&lt;/div&gt;';
      $content .= '&lt;div class="ratings"&gt;' if(function_exists("the_ratings")) { the_ratings(); } '&lt;/div&gt;';
      $content .= '&lt;/div&gt;&lt;!-- .fetured-movies --&gt;';
  endwhile;
  
  return $content;
  }
  
  add_shortcode('LatestReleases', 'latestreleases' );
  </code></pre>