Q&A Category

Solution: Wordpress Pagination Stays On Same Page

This was a big head banger.

If you are are using query_posts multiple times on a page, and are trying to paginate the second loop on the page, the following

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

will always return 1, Unless you place wp_reset_query() below the previous loop.


rewind_posts();

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

query_posts(
array(
'cat'=>‘5′,
‘orderby’=>’date’,
‘order’=>’DESC’
)
);

if(have_posts())
{
?>
// Post template goes here.
}
wp_reset_query();
?>

Pagination should now work for the next loop.

Q/A: How do I add multiple WordPress widget sidebars?

I’m putting together my first WordPress theme which requires three dynamic sidebars (don’t ask!!). For some reason I can’t figure out how to add the other two dynamic sidebars.. Could you help me please?

Adding in multiple sidebars is fairly straightforward and you can create as many as you need.

Locate your functions.php file in your theme and add the following code:

1
2
3
4
5
6
7
8
9
10
<?php
     if(function_exists('register_sidebar'))
          register_sidebar(array(
          'name' => 'Sidebar One', // The sidebar name to register
          'before_widget' => '<div class="widget">',
          'after_widget' => '</div>',
          'before_title' => '<h3>',
          'after_title' => '</h3>',
     ));
?>

Continue reading.. ›

Q/A: How can I add threaded comments to WordPress 2.7?

We’ve received our first question from a reader who asks how to incorporate threaded commenting into his WordPress 2.7 blog.

The latest version of WordPress includes lots of new functionality, including the ability for threaded commenting (also know as: nested comments). The option to enable threaded commenting is built into WordPress, however your theme must be compatible with WordPress 2.7 and support threaded commenting.

Threaded comments with WordPress

There’s already been several step by step tutorials on how to incorporate this new functionality, so rather than reinvent the wheel read this post by Otto.

Got a WordPress related question for us? Ask us here.

line