Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
46 views
in Q2A Core by
closed by

I tried using a plugin to show the category description. It works but unfortunately it has somehow conflicts with the image uploading system. So, I'm looking for the core hack way. How can I modify so that I can show the category description?

Below is the qa-cd-overrides.php file of the plugin, just for reference.

<?php
    if (!defined('QA_VERSION')) {
      header('Location: ../../');
      exit;
    }
    function qa_q_list_page_content($questions, $pagesize, $start, $count, $sometitle, $nonetitle, $navcategories, $categoryid, $categoryqcount, $categorypathprefix, $feedpathprefix, $suggest, $pagelinkparams=null, $categoryparams=null, $dummy=null)
    {
      $qa_content = qa_q_list_page_content_base($questions, $pagesize, $start, $count, $sometitle, $nonetitle, $navcategories, $categoryid, $categoryqcount, $categorypathprefix, $feedpathprefix, $suggest, $pagelinkparams, $categoryparams, $dummy);
      if(count($navcategories) && isset($categoryid)) {
        $catinfo = $navcategories[$categoryid];
        if(isset($catinfo['content']) && !empty($catinfo['content']))
         //$qa_content['title'] = $qa_content['title'].'<small style="display:block;margin-top:10px;">'.$catinfo['content'].'</small>'; // for Bootstrap
          $qa_content['title'] = $qa_content['title'].' ('.$catinfo['qcount'].')<p class="qa-a-item-content">'.$catinfo['content'].'</p>'; // for pure HTML4 / HTML5
         
      }
        return $qa_content;
 
    
    }

Q2A version: 1.8.3
closed with the note: I solved myself

1 Answer

0 votes
by

After some hours of searches and trials, I added some of the code to the file qa-include/app/q-list.php, just before return $qa_content;

 if(count($navcategories) && isset($categoryid)) {
        $catinfo = $navcategories[$categoryid];
        if(isset($catinfo['content']) && !empty($catinfo['content']))
        $qa_content['title'] = $qa_content['title'].' ('.$catinfo['qcount'].')<p class="qa-a-item-content">'.$catinfo['content'].'</p>'; // for pure HTML4 / HTML5
         
      }

...