• Hello.
    I have this code in mi sidebar.php theme, and work fine just to 2.5 version.

    <?php
    
    if ( is_category(1) || in_category('1')) { $myposts = get_posts('numberposts=5&offset=1&category=1'); } else if ( is_category(3) || in_category('3')) { $myposts = get_posts('numberposts=5&offset=1&category=3'); }  else if ( is_category(4) || in_category('4')) { $myposts = get_posts('numberposts=5&offset=1&category=4'); }  else if ( is_category(5) || in_category('5')) { $myposts = get_posts('numberposts=5&offset=1&category=5'); }  else if ( is_category(6) || in_category('6')) { $myposts = get_posts('numberposts=5&offset=1&category=6'); }  else if ( is_category(8) || in_category('8')) { $myposts = get_posts('numberposts=5&offset=1&category=8'); }  else if ( is_category(9) || in_category('9')) { $myposts = get_posts('numberposts=5&offset=1&category=9'); }  else if ( is_category(7) || in_category('7')) { $myposts = get_posts('numberposts=5&offset=1&category=7'); }
    
     foreach($myposts as $post) :
    
     ?>
    
        <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    
     <?php endforeach; ?>

    I need show in sidebar only the post of the selected category, and the same problem i have with single.php, page.php and browser.php, show only de last 10 post, and not the post of the selected categorie.
    Thanks by your time.

Viewing 1 replies (of 1 total)
  • Hi, I am trying to do the same and facing the same issue. Did you resolve this by an chance? It will be of great help if you could share how you fixed it.

    Thanks!

Viewing 1 replies (of 1 total)
  • The topic ‘Post in Sidebar by categories’ is closed to new replies.