How to print a string for flagged nodes?
You can set a new variable in your preprocess function and print it in your node--type.tpl.php as follows:

In template.php

function YOURTHEME_preprocess_node(&amp;$variables) {
  $node = $variables['node'];
  if ($node-&gt;type == 'YOUR_CONTENT_TYPE') {
    $flag = flag_get_flag('sold');
    if ($flag &amp;&amp; $flag-&gt;is_flagged($node-&gt;nid)) {
      $variables['classes_array'][] = 'node-flag-sold';
      $variables['flagged_text'] = t('Sold');
    }
  }
}


And in your node--YOUR-CONTENT-TYPE.tpl.php, put simply this snippet wherever you want to print the string:

&lt;?php if ($flagged_text): ?&gt;
  &lt;?php print $flagged_text; ?&gt;
&lt;?php endif; ?&gt;


or the same code shorter:

&lt;?php if ($flagged_text) print $flagged_text; ?&gt;


But the first one is better for readability and follows the Drupal's coding standards for template files.