Support » Fixing WordPress » List posts by tag with spaces

  • I run an MMA website dedicated to Alaska combat sports news, etc.

    I have a page showing the title holding fighters for each fight promotion. Each title holding fighter has their own single-fighter.php page where it shows a pic + some data. Below that I want to list any posts the fighter has been tagged in.

    I’ve gotten success with this method, using a custom post type that the writers can use to determine what tag should be used:

    $fighterTag = get_post_meta( get_the_ID(), ‘fighterTag’, true );
    query_posts(“tag=$fighterTag&showposts=12”); ?>

    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    …. the posts

    ^So this works as long as the tag being entered as a value for the fighterTag custom post type does not have spaces. Is there any magical way to get this puppy to work with tags that have spaces?

    Any help would be immensely appreciated!

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘List posts by tag with spaces’ is closed to new replies.