开发者

Problem with Categories in Wordpress!

开发者 https://www.devze.com 2023-02-28 07:04 出处:网络
My Original question was this: I have a wordpress installation where the Home page is set to display post

My Original question was this:

I have a wordpress installation where the Home page is set to display post from a specific category. T开发者_运维百科o achieve this, I created a template "home.php" and put the following code:

query_posts( 'cat=4&order=desc' );

When I visit the site's home page, it display posts from the category but the Navigation does not work? I have permalink structure set "/%category%/%postname%/"

Please let me know if I am doing something wrong.

Update: Now, I have solved this using this code:

$paged = (get_query_var('page')) ? get_query_var('page') : 1;
    $args = array (
        'cat' => 4,
        'orderby' => 'date',
        'order' => 'desc',
        'posts_per_page' => '10'
        );
    query_posts($args . '&paged=' . $paged);

Now the problem is that first time, it displays everything fine but if you visit any other archive page, it start displaying posts from other categories. For example, the above code displays posts from Cat=>3 as well. And on page, where I want to display posts from Category = 3, it display posts from category 4 as well.

Please help...

Thanks


What do you mean by "Navigation"? What code are you using for the navigation? Are you limiting the amount of posts? If you have problems with the pagination. You can use this:

<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; 
        query_posts("cat=4&order=desc&paged=$paged"); ?>

Please, Clarify your problems to help you.

0

精彩评论

暂无评论...
验证码 换一张
取 消