Posted By

gd6d on 04/06/10


Tagged

post wordpress category single


Versions (?)

Single post depending on the category


 / Published in: PHP
 

URL: http://www.todowp.org/mostrando-distintos-single-php-paginas-de-articulo-segun-la-categoria/

  1. <?php
  2. if (in_category(1)) { // Si el post pertenece a la cat 1, redirigir a single-1.php
  3. include(TEMPLATEPATH . '/single1.php');
  4. } elseif (in_category(2)) { // Si el post pertenece a la cat 2, redirigir a single-2.php
  5. include(TEMPLATEPATH . '/single2.php');
  6. } else { // Si el post pertenece a la cat 3, redirigir a single-3.php
  7. include(TEMPLATEPATH . '/single3.php');
  8. } ?>

Report this snippet  

You need to login to post a comment.