How to make sure that panels classes are added to a CTools pane?
In the following function, the content is provided by t(). t(), when called, returns the text "my sample text". Because that text gets assigned to $block-&gt;content, the pane is rendered with "my sample text" as the content.

function MYMODULE_messagelimits_content_type_render($subtype, $conf, $args, $context) {
  if (!empty($conf)) {
    $block = new stdClass();
    $block-&gt;title = check_plain("");
    // Show message limits.
    $block-&gt;content = t("my sample content")
    return $block;
  }
}


By contrast, this function:

function MYMODULE_messagelimits_content_type_render($subtype, $conf, $args, $context) {
  if (!empty($conf)) {
    $block = new stdClass();
    $block-&gt;title = check_plain("");
    // Show message limits
    $block-&gt;content = MYMODULE_show_message_limits();
    return $block;
  }
}


Assigns the return value of MYMODULE_show_message_limits() to $block-&gt;content, rendering the pane with that function's return value. To understand why that doesn't work as expected, we must ask, what does MYMODULE_show_message_limits() return?

if ($sent_total &gt; 1) {
  print '&lt;div class="messagesng"&gt;';
  print t('You have already started conversations with 2 people this week.') . '&lt;/div&gt;';
}
else if ($sent_total == 1) {
  print '&lt;div class="messagesok"&gt;' . t('You can start a conversation with 1 more new person this week.') . '&lt;/div&gt;';
}
else {
  print '&lt;div class="messagesok"&gt;' . t('You can start conversations with 2 new people this week.') . '&lt;/div&gt;';
}


The function above, lacks a return statement, so in pratice, it returns NULL. Hence the pane output is empty, not even an empty string.

MYMODULE_show_message_limits() does, on the other hand, execute several print calls. Since that happens at a stage when content is still being assembled, remember, this is not a template, the prints are thrown right out onto the page, in the same way it would have if it was executed in any hook invocation for example.

The solution then, is to do:

$output = '';
if ($sent_total &gt; 1) {
  $output .= '&lt;div class="messagesng"&gt;';
  $output .= t('You have already started conversations with 2 people this week.') . '&lt;/div&gt;';
}
else if ($sent_total == 1) {
  $output .= '&lt;div class="messagesok"&gt;' . t('You can start a conversation with 1 more new person this week.') . '&lt;/div&gt;';
}
else {
  $output .= '&lt;div class="messagesok"&gt;' . t('You can start conversations with 2 new people this week.') . '&lt;/div&gt;';
}
return $output;