• I need to know if it’s possible how to get_the_tags seperated and include each tag used in a post into an array so I can work with it more and more. The individual tag should be process within an URL and so should every other tag then. (kind of loop should be used I guess, foreach maybe?) Any ideas?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter antishape

    (@antishape)

    Thanks. Had a look at the page before I posted here. but didn’t recognize the PHP-array-function:
    https://php.net/manual/de/language.types.array.php

    And even if it has the same function I don’t know how to use it nor do I think it could work out like it should. Means: I need to use get_the_tags, via arrays I need to seperate them and then – maybe with foreach – process every single tag and put the $singletag into an url, for example:
    https://www.foo.org/foo?$singletag/somename
    and than I need to use strip_tags on what I get from the URL and then display it via echo / print.

    I have no clue at all how to do it. But I heard it isn’t that difficult. You use, I need code or more exact instructions what I need for this and furthermore help if I doesn’t get it the right way. I don’t know how to use all the stuff to get it the right way. Only thing I knew is to start php code and end it and do some echo / print things. If it comes to functions, brackets and whatever I am lost. So any further help and step(s)-by-step instruction are more then welcome.

    Thread Starter antishape

    (@antishape)

    I have this code now:
    [Code moderated as per the Forum Rules. Please use the pastebin]

    I get the following error message:
    Catchable fatal error: Object of class stdClass could not be converted to string

    I tried the following, the try you see above is the last one, before that I tried:
    echo '<li><strong>' . htmlspecialchars((string)$tag) . '</strong>: ' . getWikiIntroParagraph( $tag->name );

    and

    echo '<li><strong>' . htmlentites((string)$tag) . '</strong>: ' . getWikiIntroParagraph( $tag->name );

    Don’t know what happened. Even if I put
    echo $tag;

    before the line, I got no result and the same error message. Any ideas?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘get_the_tags seperated using array (PHP)’ is closed to new replies.