There is a good article on what you’re attempting to do at camera on the road.
Lorelle explains how to code the category stuff into your existing category.php for different category templates
I´ve read that page, and a find some examples of things looks nearly like that I want, but not exactly. Following some things i´ve readed in that page, I try this in my category.php:
<?php get_header(); ?>
<?php if ( in_category('5') ); ?>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" align="center" valign="top"><div class="blogtitle"></div><?php include(TEMPLATEPATH . '/basepost.php'); ?></td>
<td align="center" width="189" valign="top"><?php include(TEMPLATEPATH . '/sidebar-blog.php'); ?></td>
</tr>
</table>
<?php else; ?>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" align="center" valign="top"><?php include(TEMPLATEPATH . '/basepost.php'); ?></td>
<td align="center" width="189" valign="top"><?php include(TEMPLATEPATH . '/sidebar.php'); ?></td>
</tr>
</table>
<?php endif; ?>
<?php get_footer(); ?>
That doesn´t work. And I don´t know how to make it.
Aren’t you missing some “{” and “}” brackets from that code? I am not a coder but looking at the examples provided here Conditional_Tags it seems to me they are missing…
Finally, I did it ^^.
I used the php switch function, and the internal $cat wp variable to make it work. Look at the code:
<?php get_header(); ?>
<?php
switch ($cat) {
//BLOG
case 5:
case 46:
case 58:
case 26:
case 56:
case 48:
case 49:
case 57:
case 52:
case 27:
case 51:
case 28:
case 44:
case 24:
case 29:
case 25:
case 43:
case 47:
case 50:
echo '<table border="0" width="100%" cellspacing="0" cellpadding="0"><tr><td width="100%" align="center" valign="top"><div class="blogtitle"></div>';
include(TEMPLATEPATH . '/basepost.php');
echo '</td><td align="center" width="189" valign="top">';
include(TEMPLATEPATH . '/sidebar-blog.php');
echo '</td></tr></table>';
break;
default:
echo '<table border="0" width="100%" cellspacing="0" cellpadding="0"><tr><td width="100%" align="center" valign="top"></div>';
include(TEMPLATEPATH . '/basepost.php');
echo '</td><td align="center" width="189" valign="top">';
include(TEMPLATEPATH . '/sidebar.php');
echo '</td></tr></table>';
}
?>
<?php get_footer(); ?>
With that, all the categories on the case tags under the blog commented line uses the template under them. After the break; line, al the another categories not matching any of the case uses the template under the default. Greatly easy way to do that I want.
Thanks to all for your help.