• Hi.

    In wp 2.6 i’ve used this codeline for view only post in the catergory:
    <?php query_posts(‘category_name=name on category’); ?>

    This one doesn’t work in 2.7 version. Anyone know why?

    BR,
    Alex

Viewing 13 replies - 1 through 13 (of 13 total)
  • This appears to be a bug affecting child categories. Replace the spaces in the category with dashes to get around it for now.

    Thread Starter alex20hz

    (@alex20hz)

    filosofo:
    but i use query_posts(‘category_name=fashion&showposts=7’); now and it’s it doesn’t work.

    Thread Starter alex20hz

    (@alex20hz)

    It’s works with query_posts(‘page_id=7’); and query_posts(‘pagename=about’); but not the cat or category_name. Strange! This worked in the 2.6 version. Should i downgrade the site to 2.6 again?

    Thread Starter alex20hz

    (@alex20hz)

    there must be more users than me that uses this code on their pages? :S

    Well, to be honest: it is working for me.. I’m using it like this: query_posts('cat=11,-7&showposts=5&orderby=rand');

    Thread Starter alex20hz

    (@alex20hz)

    Must test on a diffrent site…. strange!

    Thread Starter alex20hz

    (@alex20hz)

    Ok I’ve no idea why this one doesnt work on the site. I checked with one other and test on a default theme and it worked!

    where are you using it in the other theme? (before/inside/after/instead of the loop?)

    This does seem to be a bug in 2.7.*

    It only affects category_name in query_posts when the category name has spaces in it e.g.:

    query_posts('category_name=Name of Category');

    Filosofo‘s response (above) is correct – changing the spaces to dashes solves this problem.

    If you don’t know how to do this:

    $cat_name = 'Name of Category';
    $cat_name = str_replace(' ','-',$cat_name);
    query_posts('category_name='.$cat_name);

    I’m having a similar problem I use

    <?php query_posts(‘category_name=name on category’); ?>

    It works fine, but It doesn’t include the post title and date.. any thoughts????

    Replacing “category_name” by “cat_name” work for me.

    Marlimant, you save my day !
    Tanks

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘query_posts (category_name)’ is closed to new replies.