Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
in Plugins by
closed by

i've seen that when i look the question pages i see the categorie on that a user has created a question.

But from when i've created some subcategories ( very usefull to organize better my site ) i see only the subcategory and not the relative category.

I've a lo of same subcategories for example bug or suggest that are related to every category and i'd like to see category and subcategory and not only subcategory.

The only solution is to create a lot of single category but is not so good how to have category and subcategory

Thank you
closed with the note: Solved

1 Answer

+1 vote

Put this in your theme or a layer where you want it to appear.


$this->output( backpath_to_breadcrumbs( $q_item['raw']['categorybackpath'] ) );


Here is the function.


function backpath_to_breadcrumbs($path) {
  $delimiter = "::"; // text placed between breadcrumbs
  $crumbs = explode("/", $path);
  $crumbs = array_reverse($crumbs);
  $previous = qa_opt("site_url"); 
  $output = "";
  foreach ( $crumbs as $crumb ) {
    $output .= ' <A HREF="'.$previous.$crumb.'" CLASS="breadcrumb" REL="nofollow">'.$crumb.'</A> '.$delimiter; 
    $previous .= $crumb."/";
  } // foreach
  $output = trim( substr($output, 0 , strlen($output) - strlen($delimiter) ) ); // remove last delimiter ::
  $output = '<SPAN CLASS="breadcrumb-list">'.$output.'</SPAN>';
  return $output;
} // function 


Hi Merkus,
Really Thank you i'll try next week as soon as possible and i hope that it solve this problem.
what i must insert into raw and categorybackpath on your code?

$this->output( backpath_to_breadcrumbs( $q_item['raw']['categorybackpath'] ) ); in questa riga di codice cosa devo mettere al posto di 'raw' e di 'categorybackpath'

i've tried and do not work :(

Solved.. Thank You
Sorry, but I don't know where to put this code. You said 'in my theme'. How I do it? 'Or a layer. How I do it? Thanks.