Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • humpake

    (@humpake)

    I of course mean $thumbnailsrc

    humpake

    (@humpake)

    If you’re using PHP 5.* then it’s also possible to use simplexml to pull the src-attributes value or any other attribute value out of the get_post_thumbnail function. I worked this out:

    $domsxe = simplexml_load_string(get_the_post_thumbnail());
    $thumbnailsrc = $domsxe->attributes()->src;

    You can then echo or whatever you wish do do with $domsxe that now stores the src value as a string.

Viewing 2 replies - 1 through 2 (of 2 total)