Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter sephers2

    (@sephers2)

    No worries I found the answer, instead of using get_the_category, I used php functions to split the url up to see the end bit (the slug of the category) and then get the stuff based on that, below is my new code:

    <?php
    get_header();
    get_sidebar();
    ?>
    		<div id="content">
    			<?php
    			$self = $_SERVER['PHP_SELF'];
    			$self = basename($self);
    			$catinfo = get_term_by('slug', $self, 'category');
    			$catslug = $catinfo->slug;
    			$catid = $catinfo->term_id;
    			$catname = $catinfo->name;
    			?>
    				<div id="contentheader"><?php echo $catname ?></div><!--END #contentheader-->
    				<p>
    					<?php
    					if($catslug == 'news'){
        					$myposts = get_posts('numberposts=3&offset=0&'.$catshow);
    						foreach($myposts as $post): ?>
    							<li><a href="<?php the_permalink(); ?>"><?php the_title();?></a></li>
    						<?php endforeach; ?>
    					<?php }else{
    					wp_list_categories('title_li=&hide_empty=0&child_of='.$catid);
    					?>
    					<?php } ?>
    
    				</p>
    <?php get_footer(); ?>

Viewing 1 replies (of 1 total)