Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am developing a website using WordPress. As I don't want the sidebar, I removed 'get_sidebar()' from my page. But I need to place a category in the content part (like a category for latest news) - not in a sidebar. How could I do this?

share|improve this question
    
You mean like a archive list of posts from a certain category? –  onetrickpony Jan 5 '11 at 17:18
    
Yes..how could i do this..? –  anit Jan 5 '11 at 17:41
add comment

1 Answer

You can do this with a query

<ul>
<?php
global $post;
$args = array( 'posts_per_page' => 5, 'offset'=> 1, 'category' => 1 );
$myposts = get_posts( $args );
foreach( $myposts as $post ) :  setup_postdata($post); ?>
    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
</ul>

source

You can put that in your category page or in something like Exec-PHP plugin

For looking up the current category you can grab it like

get_query_var('cat')
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.