• Resolved Clicknathan

    (@clicknathan)


    I’m wondering if there’s a URL string that can represent multiple tags.

    Something like:

    website.com/?tag=cigarettes&addiction

    This doesn’t work, it only returns the cigarettes tag result.

    Any ideas?

Viewing 6 replies - 1 through 6 (of 6 total)
  • ?tag=cigarettes,addiction

    returns posts with the tags cigarettes OR addiction

    ?tag=cigarettes+addiction

    returns posts with the tags cigarettes AND addiction

    Thread Starter Clicknathan

    (@clicknathan)

    Thanks Kaf. I had tried all combinations of ampersands, some slash combos.

    Good ol’ commas and plus signs. In this day and age of space pirates and Wii remotes how often we forget the simple things.

    Thanks for this tip – exactly what I needed too, but now I have another problem related to this.

    I display wp_title() on all my pages which works great and looks really nice. But when you generate a page with two tags, the title only shows the first tag specified and NOT the second one. It’s creates a misleading visual.

    I found a php tag for single tag title, but no multiple tag title. Is there any way to do this?

    &‘s are reserved for splitting up parameters. In your original code, tag is set to cigarettes and addiction is set, but blank. ??

    This is for 11Mystics (and anyone else curious). The following is how I’m currently grabbing the tag query string for display purposes. Inside my functions.php file is the following:

    function my_get_the_tag_query() {
     $nice_tag_query = $_SERVER['REQUEST_URI'];
     $nice_tag_query = str_replace('/tag/','', $nice_tag_query);
     $nice_tag_query = str_replace(',', ', ', $nice_tag_query);
     $nice_tag_query = str_replace('/','', $nice_tag_query);
     return $nice_tag_query;
    }

    Quick explanation: The above assumes a permalink structure where the base for all tag pages is “/tag/” (e.g. “www.example.com/tag/”). The function grabs part of the URL/URI string and then uses the str_replace() function to clean up the output by removing the “tag” and slashes. Right now, I’m leaving the plus signs as is and just adding a space after any comma.

    For the web page title, just echo the output of this function. If you’re using a common header file, then add an extra conditional statement for the title section, using WordPress’ is_tag() function.

    I wanted to check with all of you to see if there is a way to do the following:

    I am providing space for users to add tags to individual posts, and I wanted to database/track every tag entered, even the duplicates, then report back tag counts for each post in multiple formats (list/array/cloud/etc.)

    Am I better trying to do this with Keywords? How do you do it with the database? And could you still click (or sort) by tags/keywords to deliver all of the posts that share a specific tag, or tag that has been assigned a specific number of times?

    Thanks

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Multiple Tags Pages’ is closed to new replies.