WordPress.org

Ready to get started?Download WordPress

Forums

category_name actually taking slug and not category name itself? (2 posts)

  1. Chandra M
    Member
    Posted 5 years ago #

    Hi all,

    I have a query that should have pulled posts from the category name

    query_posts('category_name=$categoryname&showposts=10');

    something like this and $categoryname is pulled via theme options. It was working okay until I changed the slug to something other than default (which is usually same as the name).

    So, I believe, its actually refering from slug and not name. How do I pull it from the category name ?

  2. esmi
    Forum Moderator
    Posted 5 years ago #

    The parameter category_name is the correct one to use - which suggests that perhaps it's your variable $categoryname that might the problem. What exactly is being returned to this variable from the theme options?

    http://codex.wordpress.org/Template_Tags/query_posts#Category_Parameters

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.