• bepbrasil

    (@bepbrasil)


    Hi guys,

    I’m making a theme where depending on how category the person is viewing the colors of the theme change. The problem is that the index is getting the category of the last post added. But the index should stay with no category, so the different styles are no applied.

    Here’s the code I’m using:

    <?php
      $post = $wp_query->post;
      if ( in_category('5')) {
      ?>
      <link rel="stylesheet" type="text/css" media="screen" href="<?php bloginfo('template_directory'); ?>/styles_purple.php" />
      <?php
      } elseif ( in_category('4') ) {
      ?>
    
      <link rel="stylesheet" type="text/css" media="screen" href="<?php bloginfo('template_directory'); ?>/styles_green.php" />
    
      <?php
      } elseif ( in_category('7') ) {
      ?>
    
      <link rel="stylesheet" type="text/css" media="screen" href="<?php bloginfo('template_directory'); ?>/styles_red.php" />
    
      <?php
      } elseif (is_home()) {
      ?>
      <link rel="stylesheet" type="text/css" media="screen" href="<?php bloginfo('template_directory'); ?>/styles.php" />
    
      <?php
      } else {
      ?>
    
      <link rel="stylesheet" type="text/css" media="screen" href="<?php bloginfo('template_directory'); ?>/styles.php" />
    
      <?php } ?>

    Do you guys know how to solve this problem? How can I verified if the page IS NOT HOME, or how can I remove the problem of the index getting the last posts category.

    Thanks =)

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Problem: Index is gettng a category’ is closed to new replies.