title: How to display every post title as parent category - category - post content in wordpress?
body: <p>First post, I really need some help with some PHP code for my wordpress site. I want to be able to display all post titles onsite in this format:</p>
  
  <p>Category - Parent Category - Post Body </p>
  
  <p>For example if a post was </p>
  
  <p>Title: This is an example of a post title
  Body: SuperTest blah
  Category: Pepsi
  Parent Category: Drinks</p>
  
  <p>The post Title would be displayed as </p>
  
  <p>Pepsi - Drinks - SuperTest blah</p>
  
  <p>Currently I've added the below code into the themes function.php file which is currently changing all post titles to show the category as the title, which is only 1/3 of what I want to do.</p>
  
  <pre><code>function your_title_cat( $title, $id = null ) {
      $category_detail = get_the_category($id);//$post-&gt;ID
      $cat = isset($category_detail[0])?$category_detail[0]:'';
      if($cat){
          return $cat-&gt;cat_name;
      }
      return $title;
  }
  add_filter( 'the_title', 'your_title_cat', 10, 2 );
  </code></pre>
  
  <p>How alterations would i need to do this? I'm a novice at Php. so please be patient with me. :)</p>
  
  <p>Thanks!</p>