5 replies [Last post]
newdude
Offline
Enthusiast
Last seen: 19 weeks 3 days ago
Timezone: GMT-4
Joined: 2008-11-29
Posts: 183
Points: 279

how i can list the child categories on my category archive pages (http://castilloleathergoods.com/wordpress/category/hard-cue-cases/), right below where it says "Category: 'Parent Category Name'"????

here's the current code from my archive.php file:

<div class="posttitle">
		<?php if (have_posts()) : ?>
		<?php $post = $posts[0]; ?>
		<?php if (is_category()) { ?><h2>Category: '<?php echo single_cat_title(); ?>'</h2>
		<?php } elseif (is_day()) { ?><h2>Archive for <?php the_time('F jS, Y'); ?></h2>
		<?php } elseif (is_month()) { ?><h2>Archive for <?php the_time('F, Y'); ?></h2>
		<?php } elseif (is_year()) { ?><h2>Archive for the year <?php the_time('Y'); ?></h2>
		<?php } elseif (is_tag()) { ?><h2>Tag: <?php single_tag_title(''); ?></h2>
		<?php } elseif (is_search()) { ?><h2>Search results</h2>
		<?php } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?><h2>Archives</h2>
		<?php } ?>
	</div>

Tags:
CupidsToejam
CupidsToejam's picture
Offline
Guru
Florida
Last seen: 19 weeks 3 days ago
Florida
Timezone: GMT-4
Joined: 2008-08-15
Posts: 2636
Points: 1554

seems like a WP support

seems like a WP support question rather then CSS.

newdude
Offline
Enthusiast
Last seen: 19 weeks 3 days ago
Timezone: GMT-4
Joined: 2008-11-29
Posts: 183
Points: 279

well i asked there three days

well i asked there three days ago and got zero response so here i am.

anybody know???

Deuce
Deuce's picture
Offline
Guru
Las Vegas, NV
Last seen: 1 year 26 weeks ago
Las Vegas, NV
Timezone: GMT-5
Joined: 2005-11-20
Posts: 4422
Points: 1841

Not 100% on the code as I

Not 100% on the code as I didn't test it, but the concept seems solid Smile

<?php
foreach((get_the_category()) as $childcat) {
$postcat =$childcat->cat_ID;
if (cat_is_ancestor_of($postcat, $childcat)) {
echo '<a href="'.get_category_link($childcat->cat_ID).'">'.$childcat->cat_name . '</a>';
}}
?>

all ยป http://dictionary.reference.com/browse/all

Google isn't a bunch of guys reading and grading web sites, it's more like a bunch of monkeys sniffing food and putting the good bananas at the top. -Triumph

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 3 days 6 hours ago
London
Timezone: GMT+1
Joined: 2004-06-06
Posts: 15664
Points: 2802

Have you actually checked

Have you actually checked through the WP Codex?

This template function:
<?php wp_list_categories( $args ); ?>

takes a large number of parameters that essentially mean you can configure the displayed list in almost any fashion you can imagine.

The codex is your WP bible!

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

newdude
Offline
Enthusiast
Last seen: 19 weeks 3 days ago
Timezone: GMT-4
Joined: 2008-11-29
Posts: 183
Points: 279

Deuce wrote: Not 100% on the

Deuce wrote:

Not 100% on the code as I didn't test it, but the concept seems solid Smile

<?php
foreach((get_the_category()) as $childcat) {
$postcat =$childcat->cat_ID;
if (cat_is_ancestor_of($postcat, $childcat)) {
echo '<a href="'.get_category_link($childcat->cat_ID).'">'.$childcat->cat_name . '</a>';
}}
?>

thanks but the screen went blank when i tried that. any idea on what's missing?