Customize post category output in sitemap page

Support Forums for LiveMesh Themes & Plugins Forums Invent Theme Support Customize post category output in sitemap page

This topic is: resolved

This topic contains 2 replies, has 1 voice, and was last updated by Palmtree palmtree 2 years, 1 month ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #27645
    Palmtree
    palmtree
    Participant
    Post count: 125

    Hello codemaster,

    I would like to change the way how categories and their child category get output inside sitemap page that comes with the invent theme.

    Inside sitemap page, I don’t need to display individual posts but pages and categories. I could comment out the part outputting each posts but I would like further advise from you if possible.

    At sitemap page, you may have noticed that the “page” display in “parent and child” structure. For example child pages have indent under parent page name.

    I would like to do the same structure applies to post category. Currently they are all mixed up where I cannot see which one is parents and their children.

    It would be really great if you could help me with this.

    Thank you as always.

    #27768
    Palmtree
    palmtree
    Participant
    Post count: 125

    Hello,

    Currently the code below creates Parent and children underneath structure but child category URL isn’t output properly. Could you give me your advise?

    <?php
    	$terms = get_categories( array(
    	  'orderby' => 'name',
    	  'parent'  => 0
    		 ) );
    
    	echo '';
    ?>
    #27769
    Palmtree
    palmtree
    Participant
    Post count: 125

    Got sorted out myself.

    $terms = get_categories( array(
      'orderby' => 'name',
      'parent'  => 0,
         ) );
    echo '
      '; foreach ($terms as $term) { $categories = get_categories('child_of='.intval($term->term_id)); echo '
    • term_id). '">'.$term->name.''; echo '
        '; foreach ($categories as $category) { if ($category->parent==$term->term_id): echo '
      • '.$category->cat_name.'
      • '; endif; } echo '
      '; echo '
    • '; } echo '
    ';

    🙂

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.