Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
2.0k views
in Q2A Core by

like this example
 answered 4 hours ago by admin (3,670 points) - (Extra field data)

Q2A version: 1.6

1 Answer

+2 votes
by
selected by
 
Best answer
  1. "Admin" -> "Posting" -> "Custom field for extra information on ask form:" -> ON
  2. Assign label on question form.
  3. "Admin" -> "Posting" -> "Show the extra information on question pages with label:" -> ON
  4. Assign label on question page.
  5. Add function in qa-theme/(your theme)/qa-theme.php below.
function post_meta($post, $class, $prefix=null, $separator='<br/>') {
  $this->output('<span class="'.$class.'-meta">');
  if (isset($prefix))
    $this->output($prefix);
  $order=explode('^', @$post['meta_order']);
  foreach ($order as $element)
    switch ($element) {
    case 'what':
      $this->post_meta_what($post, $class);
      break;
    case 'when':
      $this->post_meta_when($post, $class);
      break;
    case 'where':
      $this->post_meta_where($post, $class);
      break;
    case 'who':
      $this->post_meta_who($post, $class);
      break;
    }
  $this->post_meta_flags($post, $class);
  if (!empty($post['what_2'])) {
    $this->output($separator);
    foreach ($order as $element)
      switch ($element) {
      case 'what':
        $this->output('<span class="'.$class.'-what">'.$post['what_2'].'</span>');
        break;
      case 'when':
        $this->output_split(@$post['when_2'], $class.'-when');
        break;
      case 'who':
        $this->output_split(@$post['who_2'], $class.'-who');
        break;
      }
  }
 
  /* ======== add [start] ======== */
  /*
  echo '<PRE>';
  echo print_r($post,true);
  echo '</PRE>';
  */
  if($post['raw']['type'] == 'Q') {
    require_once QA_INCLUDE_DIR.'qa-db-metas.php';
    $extra = qa_db_postmeta_get($post['raw']['postid'], 'qa_q_extra');
    if(isset($extra) && $extra != '')
      $this->output('<span class="extra_on_list"> - ('.$extra.')</span>');
  }
  /* ======== add [end] ======== */
 
  $this->output('</span>');
}
by
I changed the code of answer. My answer is one hint to you. Because I don't test based on various conditions, you must customize it to match your needs.
by
good job this is it
thanx
by
for me work after make 1. and 3. , i need add this code in qa-theme.php or ?

Thanks.
...