[resolved] Show posts from just one category - by name, not category ID (2 posts)

  1. ontargetpro
    Posted 4 years ago #

    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?

  2. ontargetpro
    Posted 4 years ago #

    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');?>

Topic Closed

This topic has been closed to new replies.

About this Topic