WordPress.org

Support

Support » Themes and Templates » [Resolved] Show posts from just one category – by name, not category ID

[Resolved] Show posts from just one category – by name, not category ID

  • ontargetpro
    Member

    @ontargetpro

    I have a multisite setup with a couple of sites sharing theme files, so while it works to call the category 293 from one site and 114 from another, it would be much cleaner, and less likely to cause trouble later, if I could just have the home.php file call the posts by category name (featured)instead of ID.

    This code works:
    <?php query_posts('cat=293,114&showposts=1');?>

    This does not(nothing returns):
    <?php query_posts('category_name=featured');?>

    Any idea what I’m doing wrong?

Viewing 1 replies (of 1 total)
  • ontargetpro
    Member

    @ontargetpro

    It doesn’t look like this is possible, but I put in a tag filter and now it works. The code looks like this:

    <?php query_posts(‘cat=293,114,82,206,170,128,4,19,91&tag=homeblogpost&showposts=1’);?>

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Show posts from just one category – by name, not category ID’ is closed to new replies.