0

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?

2
  • You mean like a archive list of posts from a certain category? Commented Jan 5, 2011 at 17:18
  • Yes..how could i do this..?
    – anit
    Commented Jan 5, 2011 at 17:41

1 Answer 1

2

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')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.