Title: deftru's Replies | WordPress.org

---

# deftru

  [  ](https://wordpress.org/support/users/deftru/)

 *   [Profile](https://wordpress.org/support/users/deftru/)
 *   [Topics Started](https://wordpress.org/support/users/deftru/topics/)
 *   [Replies Created](https://wordpress.org/support/users/deftru/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/deftru/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/deftru/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/deftru/engagements/)
 *   [Favorites](https://wordpress.org/support/users/deftru/favorites/)

 Search replies:

## Forum Replies Created

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/users/deftru/replies/page/2/?output_format=md)
[→](https://wordpress.org/support/users/deftru/replies/page/2/?output_format=md)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Plugin: Contact Form 8] no confirmation or error messages](https://wordpress.org/support/topic/plugin-contact-form-8-no-confirmation-or-error-messages/)
 *  [deftru](https://wordpress.org/support/users/deftru/)
 * (@deftru)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/plugin-contact-form-8-no-confirmation-or-error-messages/#post-1327905)
 * i have the same problem
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [wp_list_categories echo current or parent cat on single.php](https://wordpress.org/support/topic/wp_list_categories-echo-current-or-parent-cat/)
 *  Thread Starter [deftru](https://wordpress.org/support/users/deftru/)
 * (@deftru)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/wp_list_categories-echo-current-or-parent-cat/#post-1768767)
 * found a solution here:
    [http://www.screenshine.net/blog/1474_wordpress-plugin-show-active-category](http://www.screenshine.net/blog/1474_wordpress-plugin-show-active-category)
 * with the changed foreach-loop:
 *     ```
       foreach (wp_get_post_categories($post->ID) as $catid) {
       if (preg_match('#cat-item-' . $catid . '"#', $text)) {
       $text = str_replace('cat-item-' . $catid . '"', 'cat-item-' . $catid . ' current-cat"', $text);
       }
       }
       ```
   
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [display all subcategories within posts on single.php](https://wordpress.org/support/topic/display-all-subcategories-within-posts-on-singlephp/)
 *  Thread Starter [deftru](https://wordpress.org/support/users/deftru/)
 * (@deftru)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/display-all-subcategories-within-posts-on-singlephp/#post-1693013)
 * nope. writes nothing..
 * everything else is fine. i just need the parent category. and best outside any
   loop.
 * `echo(get_category_parents($cat, TRUE, ' &raquo; '));`
 * writes for example
    category >> subcat post subcat post category >> subcategory
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [display all subcategories within posts on single.php](https://wordpress.org/support/topic/display-all-subcategories-within-posts-on-singlephp/)
 *  Thread Starter [deftru](https://wordpress.org/support/users/deftru/)
 * (@deftru)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/display-all-subcategories-within-posts-on-singlephp/#post-1693010)
 * no, that is not the problem.:)
 * the problem is that the function :
    `echo "<h1>". $cat->name . "</h1>";` writes
   2 categories. one at the beginning – which is good and one at the end (which 
   is a subcategory in category-style) .
 * i think the foreach function is placed wrong. hope u know what i mean.
    thx anyway
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [display all subcategories within posts on single.php](https://wordpress.org/support/topic/display-all-subcategories-within-posts-on-singlephp/)
 *  Thread Starter [deftru](https://wordpress.org/support/users/deftru/)
 * (@deftru)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/display-all-subcategories-within-posts-on-singlephp/#post-1692997)
 * a little problem..the result is perfect.. just one tiny little thing:
 * at the end (have a look:
    [http://www.goodandbad.net/sport-akustik/limited/perfekte-akustik-im-fur-forschung-und-lehre/](http://www.goodandbad.net/sport-akustik/limited/perfekte-akustik-im-fur-forschung-und-lehre/))
   it writes one subcategory (presse)with with the style of the category (<h2>)
 * but i just want to display the parent category with <h2> on top (Ltd.)
 *     ```
       <?php
       $post_categories = wp_get_post_categories( $post->ID );
       foreach($post_categories as $c){
         $cat = get_category( $c );
         echo "<h1>". $cat->name . "</h1>";
         $childCats = get_categories( array('child_of' => $c) );
         if(is_array($childCats)):
           foreach($childCats as $child){ ?>
               <h2><?php echo $child->name; ?></h2>
       <?php
               query_posts('cat='.$child->term_id);
               while(have_posts()): the_post(); $do_not_duplicate = $post->ID;
                //post code stuff here;
               endwhile;
               wp_reset_query();
           }
         endif;
       }
       ?>
       ```
   
 * Presse should not be displayed.
    would be glad if this could be fixed.
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Postionation? Previous & Next for parent Category or Subcategory](https://wordpress.org/support/topic/postionation-previous-next-for-parent-category-or-subcategory/)
 *  Thread Starter [deftru](https://wordpress.org/support/users/deftru/)
 * (@deftru)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/postionation-previous-next-for-parent-category-or-subcategory/#post-1695593)
 * And how to you get rid of it?
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Category Navigation on single.php](https://wordpress.org/support/topic/category-navigation-on-singlephp/)
 *  Thread Starter [deftru](https://wordpress.org/support/users/deftru/)
 * (@deftru)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/category-navigation-on-singlephp/page/2/#post-1691637)
 * a little problem..
    the result is perfect.. just one tiny little thing.
 * at the end it writes one subcategory with <h2>
    but i just want to display the
   parent category with <h2> on top (Ltd.)
 * have a look:
    [http://www.goodandbad.net/sport-akustik/limited/perfekte-akustik-im-fur-forschung-und-lehre/](http://www.goodandbad.net/sport-akustik/limited/perfekte-akustik-im-fur-forschung-und-lehre/)
 *     ```
       <?php
       $post_categories = wp_get_post_categories( $post->ID );
       foreach($post_categories as $c){
         $cat = get_category( $c );
         echo "<h1>". $cat->name . "</h1>";
         $childCats = get_categories( array('child_of' => $c) );
         if(is_array($childCats)):
           foreach($childCats as $child){ ?>
               <h2><?php echo $child->name; ?></h2>
       <?php
               query_posts('cat='.$child->term_id);
               while(have_posts()): the_post(); $do_not_duplicate = $post->ID;
                //post code stuff here;
               endwhile;
               wp_reset_query();
           }
         endif;
       }
       ?>
       ```
   
 * Presse should not be displayed.
    would be glad if this could be fixed.
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [display all subcategories within posts on single.php](https://wordpress.org/support/topic/display-all-subcategories-within-posts-on-singlephp/)
 *  Thread Starter [deftru](https://wordpress.org/support/users/deftru/)
 * (@deftru)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/display-all-subcategories-within-posts-on-singlephp/#post-1692909)
 * problem solved!
    THIS IS THE FUNCTIONING CODE FROM chinmoy29:
 *     ```
       <?php
       $post_categories = wp_get_post_categories( $post->ID );
       foreach($post_categories as $c){
         $cat = get_category( $c );
         echo "<h1>". $cat->name . "</h1>";
         $childCats = get_categories( array('child_of' => $c) );
         if(is_array($childCats)):
           foreach($childCats as $child){ ?>
               <h2><?php echo $child->name; ?></h2>
       <?php
               query_posts('cat='.$child->term_id);
               while(have_posts()): the_post(); $do_not_duplicate = $post->ID;
                //post code stuff here;
               endwhile;
               wp_reset_query();
           }
         endif;
       }
       ?>
       ```
   
 * THX
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Category Navigation on single.php](https://wordpress.org/support/topic/category-navigation-on-singlephp/)
 *  Thread Starter [deftru](https://wordpress.org/support/users/deftru/)
 * (@deftru)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/category-navigation-on-singlephp/#post-1691591)
 * THIS IS THE FUNCTIONING CODE FROM chinmoy29:
 *     ```
       <?php
       $post_categories = wp_get_post_categories( $post->ID );
       foreach($post_categories as $c){
         $cat = get_category( $c );
         echo "<h1>". $cat->name . "</h1>";
         $childCats = get_categories( array('child_of' => $c) );
         if(is_array($childCats)):
           foreach($childCats as $child){ ?>
               <h2><?php echo $child->name; ?></h2>
       <?php
               query_posts('cat='.$child->term_id);
               while(have_posts()): the_post(); $do_not_duplicate = $post->ID;
                //post code stuff here;
               endwhile;
               wp_reset_query();
           }
         endif;
       }
       ?>
       ```
   
 * THX
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Category Navigation on single.php](https://wordpress.org/support/topic/category-navigation-on-singlephp/)
 *  Thread Starter [deftru](https://wordpress.org/support/users/deftru/)
 * (@deftru)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/category-navigation-on-singlephp/#post-1691589)
 * PERFECT!!!! thank you so much!
 * I would be glad if I could also understand it;-)
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Category Navigation on single.php](https://wordpress.org/support/topic/category-navigation-on-singlephp/)
 *  Thread Starter [deftru](https://wordpress.org/support/users/deftru/)
 * (@deftru)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/category-navigation-on-singlephp/#post-1691586)
 * thanks chinmoy again!
 * the fatal error msg:
    Fatal error: Call to undefined function: query() in /homepages/
   4/d188254744/htdocs/sport-akustik/wp-content/themes/Q/left-1.php on line 22
 * thx
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Category Navigation on single.php](https://wordpress.org/support/topic/category-navigation-on-singlephp/)
 *  Thread Starter [deftru](https://wordpress.org/support/users/deftru/)
 * (@deftru)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/category-navigation-on-singlephp/#post-1691585)
 * thanks chinmoy!
 * the result looks good. unfortunately the posts on the single.php are not going
   anywhere. it always shows the last post but i can’t go to the e.g. first post
   of the subcategory..
 * look at:
    [http://www.goodandbad.net/sport-akustik/limited/referenz/](http://www.goodandbad.net/sport-akustik/limited/referenz/)
 * THX
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [display all subcategories within posts on single.php](https://wordpress.org/support/topic/display-all-subcategories-within-posts-on-singlephp/)
 *  Thread Starter [deftru](https://wordpress.org/support/users/deftru/)
 * (@deftru)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/display-all-subcategories-within-posts-on-singlephp/#post-1692904)
 * hi alchymyth!
 * thanks 4 your response. i do have a code working on the category.php. but -and
   i am more webdesigner than programmer 😉 – i am not sure why it doesn’t work 
   on the single.php.
 * maybe you could have a look and help me out: THX
 *     ```
       foreach((get_the_category()) as $category)
       	{
           $postcat= $category->cat_ID;
           $catname =$category->cat_name;
           }
       <h2><?php echo $catname; ?></h2>
       	<?php $categories = get_categories("child_of=5"); foreach ($categories as $cat) { ?>
       	<?php query_posts("cat=$cat->cat_ID&showposts=-1&order=ASC&orderby=name"); ?>
       		<h3><?php single_cat_title(); ?></h3>
       		<?php while (have_posts()) : the_post(); ?>
   
       		<div class="what">
       			<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to
       			<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
       		</div>
       	<?php endwhile; ?>
       <?php } ?>
       ```
   
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Category Navigation on single.php](https://wordpress.org/support/topic/category-navigation-on-singlephp/)
 *  Thread Starter [deftru](https://wordpress.org/support/users/deftru/)
 * (@deftru)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/category-navigation-on-singlephp/#post-1691579)
 * Hi David. Thanks for your response. To make it clear look at my textpage :
 * [http://www.goodandbad.net/sport-akustik/category/know-how/](http://www.goodandbad.net/sport-akustik/category/know-how/)
 * On the left site you see the navigation structure
 * Title current category
    -title subcategory 1 posts within -title subcategory 
   2 posts within
 * and this is what i want to see on my single.php
 * thanks
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Category Navigation on single.php](https://wordpress.org/support/topic/category-navigation-on-singlephp/)
 *  Thread Starter [deftru](https://wordpress.org/support/users/deftru/)
 * (@deftru)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/category-navigation-on-singlephp/#post-1691554)
 * [@royalprince](https://wordpress.org/support/users/royalprince/): i need the 
   subcategories and the posts within .. but thanks

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/users/deftru/replies/page/2/?output_format=md)
[→](https://wordpress.org/support/users/deftru/replies/page/2/?output_format=md)