WordPress.org

Support

Support » How-To and Troubleshooting » category name help

category name help

  • In the code example below, I have a line –

    wp_list_pages(“title_li=”.$post->post_parent.” etc…

    The var $post->post_parent returns a category number. How do I get it to return the category name?

    Thanks!

    <?php
    			if($post->post_parent) {
    				$children = wp_list_pages("title_li=".$post->post_parent."&child_of=".$post->post_parent."&echo=0");
    			} else {
    				$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
    			}
    			if ($children) { ?>
    				$cat = $post->post_parent;
    				<ul>
    				<?php echo $children; ?>
    				</ul>
    			<?php } ?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘category name help’ is closed to new replies.