Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/02/2013, 14:54
Avatar de antonio3407
antonio3407
 
Fecha de Ingreso: noviembre-2004
Ubicación: Castellón de la Plana, Spain
Mensajes: 126
Antigüedad: 19 años, 5 meses
Puntos: 11
mostrar subcategorias de una taxonomia

Este codigo muestra imagenes en cada una de las subcategorias de los posts, pero ahora he creado unos custom posts en concreto uno llamado seguridad.... Como puedo adaptar este codigo para mostrar las subcategorias con imagen en la taxonomia del custom post llamada seguridad.

Código:
<?php get_header(); ?>
<div id="content">

	<!--the loop-->
	<?php $subCategories = array() ?>
	<?php if (have_posts()) : ?>

	<h6>
	<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
	<?php /* If this is a category archive */ if (is_category()) { ?>				
	<?php echo single_cat_title(); ?>
	</h6>
        <?php 
            foreach (get_categories() as $category) {
                if( strpos($_SERVER['REQUEST_URI'],$category->slug)) {
                    break;
                }
            }
            $subCategories = split('/',get_category_children($category->cat_ID));
            $subCategories = array_slice($subCategories, 1); 
            ?>
        <ul id="subcategories">
            <?php foreach ($subCategories as $subCategoryId): ?>
                <?php $subCategory = get_category($subCategoryId) ?>
                <?php $url = get_settings('home') . '/seccion/' . $category->slug . '/' . $subCategory->slug ?>
                
            <li class="subcategories">
                <a href="<?php echo $url ?>">
                    <img src="<?php echo get_settings('home') . '/images/subcat-' . $subCategory->slug . '.jpg' ?>" 
                         title="<?php echo $subCategory->name ?>" />
                    <span><?php echo $subCategory->name ?></span>
                </a>
            </li>

            <?php endforeach ?>
        </ul>
	<?php /* If this is a daily archive */ } elseif (is_day()) { ?>
	Archive for <?php the_time('F jS, Y'); ?>
		
	<?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
	Archive for <?php the_time('F, Y'); ?>

	<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
	Archive for <?php the_time('Y'); ?>
		
	<?php /* If this is a search */ } elseif (is_search()) { ?>
	Search Results
		
	<?php /* If this is an author archive */ } elseif (is_author()) { ?>
	Author Archive

	<?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
	Blog Archives

	<!--do not delete-->
	<?php } ?>
	</h6>
		
	<!--loop article begin-->
	<?php if ( $subCategories === array() ): ?>
	<?php while (have_posts()) : the_post(); ?>
	<!--post title as a link-->
	<h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
				
	<!--Post Meta-->
	<div class="post-meta-top">
	<div class="auth"><span>Creado por <strong><?php the_author_posts_link(); ?></strong></span></div>
	<div class="date"><span><?php the_time('F j, Y'); ?></span></div>
	<div class="clearboth"></div>
	</div>

	<!--optional excerpt or automatic excerpt of the post-->
	<?php the_content(); ?>

	<!--Post Meta-->
	<div class="post-meta-bottom">
	<!--<?php if (function_exists('the_tags')) { ?><strong>Tags: </strong><?php the_tags('', ', ', ''); ?><br /><?php } ?>-->
	<div class="cat"><span class="cats"><?php the_category(', ') ?></span><span class="tags"><?php the_tags('', ', ', ''); ?></span></div>
	<div class="clearboth"></div>
	</div>
		
       <!--one post end-->
	<?php endwhile; ?>
        <?php endif ?>
       
       <?php if ( $subCategories === array() ): ?>
            <!-- Previous/Next page navigation -->
            <div class="page-nav">
                    <div class="nav-previous"><?php previous_posts_link('&larr; Previous Page') ?></div>
                    <div class="nav-next"><?php next_posts_link('Next Page &rarr;') ?></div>
            </div>
       <?php endif ?>
	
	<!-- do not delete-->
	<?php else : ?>

	Not Found

	<!--do not delete-->
	<?php endif; ?>
		
	
<!--archive.php end-->

</div>
<!--include sidebar-->
<?php get_sidebar();?>
<!--include footer-->
<?php get_footer(); ?>
__________________
bañeras